Change many %g format specifiers to %.*g with precision DBL_DIG + 1.
[pspp] / src / ui / gui / psppire-dialog-action-oneway.c
index 66b80f6417e901b8b908102e573f33d0aaf557de..c817f71f152a983d8f9515b39cc2e4c15e924c96 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2012, 2013  Free Software Foundation
+   Copyright (C) 2012, 2013, 2014  Free Software Foundation
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -19,6 +19,8 @@
 
 #include "psppire-dialog-action-oneway.h"
 
+#include <float.h>
+
 #include "psppire-var-view.h"
 #include "psppire-acr.h"
 
@@ -89,7 +91,7 @@ generate_syntax (PsppireDialogAction *act)
 
          gtk_tree_model_get (GTK_TREE_MODEL (ls), &iter, 0, &v, -1);
 
-         ds_put_c_format (&dss, " %g", v);
+         ds_put_c_format (&dss, " %.*g", DBL_DIG + 1, v);
        }
     }
 
@@ -177,7 +179,7 @@ list_store_changed (PsppireDialogActionOneway *csd)
       total += v;
     }
 
-  text = g_strdup_printf ("%g", total);
+  text = g_strdup_printf ("%.*g", DBL_DIG + 1, total);
 
   gtk_entry_set_text (GTK_ENTRY (csd->ctotal), text);