/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
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
#include <config.h>
#include <ctype.h>
+#include <float.h>
#include <stdlib.h>
#include "data/attributes.h"
double x, y;
mv_get_range (mv, &x, &y);
if (x == LOWEST)
- cp += sprintf (cp, "LOWEST THRU %g", y);
+ cp += sprintf (cp, "LOWEST THRU %.*g", DBL_DIG + 1, y);
else if (y == HIGHEST)
- cp += sprintf (cp, "%g THRU HIGHEST", x);
+ cp += sprintf (cp, "%.*g THRU HIGHEST", DBL_DIG + 1, x);
else
- cp += sprintf (cp, "%g THRU %g", x, y);
+ cp += sprintf (cp, "%.*g THRU %.*g",
+ DBL_DIG + 1, x,
+ DBL_DIG + 1, y);
cnt++;
}
for (i = 0; i < mv_n_values (mv); i++)
if (cnt++ > 0)
cp += sprintf (cp, "; ");
if (var_is_numeric (v))
- cp += sprintf (cp, "%g", value->f);
+ cp += sprintf (cp, "%.*g", DBL_DIG + 1, value->f);
else
{
int width = var_get_width (v);
/* PSPP - a program for statistical analysis.
- Copyright (C) 2005, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2009, 2010, 2011, 2014 Free Software Foundation, Inc.
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
#include "value-parser.h"
+#include <float.h>
#include <stdbool.h>
#include "data/data-in.h"
if (*y < *x)
{
double t;
- msg (SW, _("The high end of the range (%g) is below the low end (%g). "
- "The range will be treated as if reversed."),
- *y, *x);
+ msg (SW, _("The high end of the range (%.*g) is below the low end "
+ "(%.*g). The range will be treated as if reversed."),
+ DBL_DIG + 1, *y, DBL_DIG + 1, *x);
t = *x;
*x = *y;
*y = t;
}
else if (*x == *y)
- msg (SW, _("Ends of range are equal (%g)."), *x);
+ msg (SW, _("Ends of range are equal (%.*g)."), DBL_DIG + 1, *x);
return true;
}
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2009, 2010, 2012, 2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2009, 2010, 2012, 2013, 2014 Free Software Foundation, Inc.
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
#include <config.h>
+#include <float.h>
#include <stdlib.h>
#include "data/case.h"
str, src_width);
}
else
- recoded_value = c_xasprintf ("%g", from->f);
+ recoded_value = c_xasprintf ("%.*g", DBL_DIG + 1, from->f);
/* Remove trailing whitespace */
len = strlen (recoded_value);
/* PSPP - a program for statistical analysis.
- Copyright (C) 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009, 2010, 2011, 2014 Free Software Foundation, Inc.
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
#include "language/stats/binomial.h"
+#include <float.h>
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_randist.h>
if ( bst->cutpoint != SYSMIS)
{
- ds_put_format (&catstr[0], "<= %g", bst->cutpoint);
+ ds_put_format (&catstr[0], "<= %.*g",
+ DBL_DIG + 1, bst->cutpoint);
}
else
{
/* PSPP - a program for statistical analysis.
- Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011, 2014 Free Software Foundation, Inc.
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
#include "language/stats/cochran.h"
+#include <float.h>
#include <gsl/gsl_cdf.h>
#include <stdbool.h>
tab_joint_text (table, 1, 0, 2, 0,
TAT_TITLE | TAB_CENTER, _("Value"));
- tab_text_format (table, 1, 1, 0, _("Success (%g)"), ct->success);
- tab_text_format (table, 2, 1, 0, _("Failure (%g)"), ct->failure);
+ tab_text_format (table, 1, 1, 0, _("Success (%.*g)"),
+ DBL_DIG + 1, ct->success);
+ tab_text_format (table, 2, 1, 0, _("Failure (%.*g)"),
+ DBL_DIG + 1, ct->failure);
tab_hline (table, TAL_2, 0, tab_nc (table) - 1, column_headers);
tab_vline (table, TAL_2, row_headers, 0, tab_nr (table) - 1);
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
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
#include <config.h>
#include <ctype.h>
+#include <float.h>
#include <gsl/gsl_cdf.h>
#include <stdlib.h>
#include <stdio.h>
case 1:
case 2:
if (var_is_numeric (rv))
- sprintf (buf, _("For cohort %s = %g"),
- var_to_string (rv), pt->rows[i - 1].f);
+ sprintf (buf, _("For cohort %s = %.*g"),
+ var_to_string (rv), DBL_DIG + 1, pt->rows[i - 1].f);
else
sprintf (buf, _("For cohort %s = %.*s"),
var_to_string (rv),
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-2000, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-2000, 2009-2014 Free Software Foundation, Inc.
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
#include <config.h>
+#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
nc = 0;
tab_text (t, nc++, i + 1, TAB_LEFT, var_to_string (dv->v));
- tab_text_format (t, nc++, i + 1, 0, "%g", dv->valid);
+ tab_text_format (t, nc++, i + 1, 0, "%.*g", DBL_DIG + 1, dv->valid);
if (dsc->format == DSC_SERIAL)
- tab_text_format (t, nc++, i + 1, 0, "%g", dv->missing);
+ tab_text_format (t, nc++, i + 1, 0, "%.*g", DBL_DIG + 1, dv->missing);
for (j = 0; j < DSC_N_STATS; j++)
if (dsc->show_stats & (1ul << j))
tab_double (t, nc++, i + 1, TAB_NONE, dv->stats[j], NULL);
}
- tab_title (t, _("Valid cases = %g; cases with missing value(s) = %g."),
- dsc->valid, dsc->missing_listwise);
+ tab_title (t, _("Valid cases = %.*g; cases with missing value(s) = %.*g."),
+ DBL_DIG + 1, dsc->valid,
+ DBL_DIG + 1, dsc->missing_listwise);
tab_submit (t);
}
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
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
#include <config.h>
+#include <float.h>
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_matrix.h>
#include <math.h>
ds_destroy (&vstr);
- tab_text_format (t, count + 2, c_num + 2, TAB_RIGHT, "%g", coeffn->coeff);
+ tab_text_format (t, count + 2, c_num + 2, TAB_RIGHT, "%.*g",
+ DBL_DIG + 1, coeffn->coeff);
}
++c_num;
}
#include <config.h>
+#include <float.h>
#include <stdbool.h>
#include <gsl/gsl_cdf.h>
/* Degrees of freedom */
- tab_text_format (t, 3, 1, TAB_RIGHT, "%g", c->dfm);
- tab_text_format (t, 3, 2, TAB_RIGHT, "%g", c->dfe);
- tab_text_format (t, 3, 3, TAB_RIGHT, "%g", c->dft);
+ tab_text_format (t, 3, 1, TAB_RIGHT, "%.*g", DBL_DIG + 1, c->dfm);
+ tab_text_format (t, 3, 2, TAB_RIGHT, "%.*g", DBL_DIG + 1, c->dfe);
+ tab_text_format (t, 3, 3, TAB_RIGHT, "%.*g", DBL_DIG + 1, c->dft);
/* Mean Squares */
tab_double (t, 4, 1, TAB_RIGHT, msm, NULL);
/* PSPP - a program for statistical analysis. -*-c-*-
- Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011, 2014 Free Software Foundation, Inc.
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
#include "language/stats/runs.h"
+#include <float.h>
#include <gsl/gsl_cdf.h>
#include <math.h>
}
casegrouper_destroy (grouper);
if (multimodal)
- msg (MW, _("Multiple modes exist for variable `%s'. Using %g as the threshold value."),
- var_get_name (var), run->cutpoint);
+ msg (MW, _("Multiple modes exist for variable `%s'. "
+ "Using %.*g as the threshold value."),
+ var_get_name (var), DBL_DIG + 1, run->cutpoint);
}
}
break;
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
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
#include <config.h>
+#include <float.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
{
return (settings_get_blanks () == SYSMIS
? xstrdup ("SYSMIS")
- : xasprintf ("%g", settings_get_blanks ()));
+ : xasprintf ("%.*g", DBL_DIG + 1, settings_get_blanks ()));
}
static void
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2009, 2010, 2011, 2014 Free Software Foundation, Inc.
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
#include <config.h>
+#include <float.h>
#include <stdint.h>
#include <stdlib.h>
"as an index into vector %s."),
vector_get_name (compute->vector));
else
- msg (SW, _("When executing COMPUTE: %g is not a valid value as "
+ msg (SW, _("When executing COMPUTE: %.*g is not a valid value as "
"an index into vector %s."),
- index, vector_get_name (compute->vector));
+ DBL_DIG + 1, index, vector_get_name (compute->vector));
return TRNS_CONTINUE;
}
}
else if (rindx < 1 || rindx > vector_get_var_cnt (compute->vector))
{
- msg (SW, _("When executing COMPUTE: %g is not a valid value as "
+ msg (SW, _("When executing COMPUTE: %.*g is not a valid value as "
"an index into vector %s."),
- index, vector_get_name (compute->vector));
+ DBL_DIG + 1, index, vector_get_name (compute->vector));
return TRNS_CONTINUE;
}
/* PSPP - a program for statistical analysis.
- Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010, 2011, 2012, 2014 Free Software Foundation, Inc.
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
#include "math/categoricals.h"
#include "math/interaction.h"
+#include <float.h>
#include <stdio.h>
#include "data/case.h"
assert (vn->var == var);
- printf ("%g(%d)", val->f, valn->index);
+ printf ("%.*g(%d)", DBL_DIG + 1, val->f, valn->index);
if (vv < iact->n_vars - 1)
printf (", ");
}
/* PSPP - a program for statistical analysis.
- Copyright (C) 2004, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009, 2010, 2011, 2014 Free Software Foundation, Inc.
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
{
double pos = (s + lower) * tick_interval;
draw_tick (cr, geom, orient, false,
- s * tick_interval * geom->axis[orient].scale, "%g", pos);
+ s * tick_interval * geom->axis[orient].scale, "%.*g",
+ DBL_DIG + 1, pos);
}
}
/* PSPP - a program for statistical analysis.
- Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2011, 2014 Free Software Foundation, Inc.
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
#include "output/charts/plot-hist.h"
+#include <float.h>
#include <gsl/gsl_randist.h>
#include "data/val-type.h"
if (label)
draw_tick (cr, geom, SCALE_ABSCISSA, bins > 10,
- x_pos + width / 2.0, "%g", (upper + lower) / 2.0);
+ x_pos + width / 2.0, "%.*g",
+ DBL_DIG + 1, (upper + lower) / 2.0);
}
void
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2010, 2011, 2012, 2013 Free Software Foundation
+ Copyright (C) 2010, 2011, 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
#include "dialog-common.h"
+#include <float.h>
#include <gl/c-xvasprintf.h>
#include <language/stats/aggregate.h>
gtk_entry_set_text (GTK_ENTRY (agg->summary_var_label_entry), label);
gtk_entry_set_text (GTK_ENTRY (agg->summary_sv_entry), srcvar);
- text = c_xasprintf ("%g", arg1);
+ text = c_xasprintf ("%.*g", DBL_DIG + 1, arg1);
gtk_entry_set_text (GTK_ENTRY (agg->summary_arg1_entry), text);
g_free (text);
- text = c_xasprintf ("%g", arg2);
+ text = c_xasprintf ("%.*g", DBL_DIG + 1, arg2);
gtk_entry_set_text (GTK_ENTRY (agg->summary_arg2_entry), text);
g_free (text);
ds_put_cstr (&dss, srcvar);
if ( arity > 0)
- ds_put_c_format (&dss, ", %g", arg1);
+ ds_put_c_format (&dss, ", %.*g", DBL_DIG + 1, arg1);
if ( arity > 1)
- ds_put_c_format (&dss, ", %g", arg2);
+ ds_put_c_format (&dss, ", %.*g", DBL_DIG + 1, arg2);
ds_put_cstr (&dss, ")");
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2012 Free Software Foundation
+ Copyright (C) 2012, 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
#include "psppire-dialog-action-binomial.h"
#include "psppire-value-entry.h"
+#include <float.h>
+
#include "dialog-common.h"
#include "helper.h"
#include <ui/syntax-gen.h>
ds_init_cstr (&str, "NPAR TEST\n\t/BINOMIAL");
if ( get_proportion (scd, &prop))
- ds_put_c_format (&str, "(%g)", prop);
+ ds_put_c_format (&str, "(%.*g)", DBL_DIG + 1, prop);
ds_put_cstr (&str, " =");
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2010, 2011, 2012, 2013 Free Software Foundation
+ Copyright (C) 2010, 2011, 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
#include "psppire-dialog-action-chisquare.h"
+#include <float.h>
+
#include "psppire-var-view.h"
#include "psppire-dialog.h"
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);
}
}
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation
+ Copyright (C) 2009, 2010, 2011, 2012, 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
#include "psppire-dialog-action-factor.h"
+#include <float.h>
+
#include "psppire-var-view.h"
#include "dialog-common.h"
#include "psppire-selector.h"
if ( rd->extraction.explicit_nfactors )
ds_put_c_format (&str, "FACTORS (%d)", rd->extraction.n_factors);
else
- ds_put_c_format (&str, "MINEIGEN (%g)", rd->extraction.mineigen);
+ ds_put_c_format (&str, "MINEIGEN (%.*g)",
+ DBL_DIG + 1, rd->extraction.mineigen);
/*
The CRITERIA = ITERATE subcommand is overloaded.
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2008, 2010, 2011, 2012 Free Software Foundation
+ Copyright (C) 2008, 2010, 2011, 2012, 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
#include "psppire-dialog-action-logistic.h"
#include "psppire-value-entry.h"
+#include <float.h>
+
#include "dialog-common.h"
#include "helper.h"
#include <ui/syntax-gen.h>
ds_put_cstr (&str, "\n\t/CRITERIA =");
- syntax_gen_pspp (&str, " CUT(%g)", rd->cut_point);
+ syntax_gen_pspp (&str, " CUT(%.*g)", DBL_DIG + 1, rd->cut_point);
syntax_gen_pspp (&str, " ITERATE(%d)", rd->max_iterations);
if (rd->conf)
{
- syntax_gen_pspp (&str, "\n\t/PRINT = CI(%g)", rd->conf_level);
+ syntax_gen_pspp (&str, "\n\t/PRINT = CI(%.*g)",
+ DBL_DIG + 1, rd->conf_level);
}
if (rd->constant)
/* 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
#include "psppire-dialog-action-oneway.h"
+#include <float.h>
+
#include "psppire-var-view.h"
#include "psppire-acr.h"
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);
}
}
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);
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2011 Free Software Foundation
+ Copyright (C) 2011, 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
#include <config.h>
+#include <float.h>
#include <gtk/gtk.h>
#include "dialog-common.h"
#include "psppire-val-chooser.h"
{
case OV_NUMERIC:
{
- gchar *text = g_strdup_printf ("%g", ov->v.v);
+ gchar *text = g_strdup_printf ("%.*g", DBL_DIG + 1, ov->v.v);
g_value_set_string (dest, text);
g_free (text);
}
g_unichar_to_utf8 (0x2013, en_dash);
- text = g_strdup_printf ("%g %s %g",
- ov->v.range[0],
- en_dash,
- ov->v.range[1]);
+ text = g_strdup_printf ("%.*g %s %.*g",
+ DBL_DIG + 1, ov->v.range[0],
+ en_dash,
+ DBL_DIG + 1, ov->v.range[1]);
g_value_set_string (dest, text);
g_free (text);
}
g_unichar_to_utf8 (0x2013, en_dash);
- text = g_strdup_printf ("LOWEST %s %g",
+ text = g_strdup_printf ("LOWEST %s %.*g",
en_dash,
- ov->v.range[1]);
+ DBL_DIG + 1, ov->v.range[1]);
g_value_set_string (dest, text);
g_free (text);
g_unichar_to_utf8 (0x2013, en_dash);
- text = g_strdup_printf ("%g %s HIGHEST",
- ov->v.range[0],
+ text = g_strdup_printf ("%.*g %s HIGHEST",
+ DBL_DIG + 1, ov->v.range[0],
en_dash);
g_value_set_string (dest, text);
switch (ov->type)
{
case OV_NUMERIC:
- ds_put_c_format (str, "%g", ov->v.v);
+ ds_put_c_format (str, "%.*g", DBL_DIG + 1, ov->v.v);
break;
case OV_STRING:
{
ds_put_cstr (str, "ELSE");
break;
case OV_RANGE:
- ds_put_c_format (str, "%g THRU %g",
- ov->v.range[0],
- ov->v.range[1]);
+ ds_put_c_format (str, "%.*g THRU %.*g",
+ DBL_DIG + 1, ov->v.range[0],
+ DBL_DIG + 1, ov->v.range[1]);
break;
case OV_LOW_UP:
- ds_put_c_format (str, "LOWEST THRU %g",
- ov->v.range[1]);
+ ds_put_c_format (str, "LOWEST THRU %*gg",
+ DBL_DIG + 1, ov->v.range[1]);
break;
case OV_HIGH_DOWN:
- ds_put_c_format (str, "%g THRU HIGHEST",
- ov->v.range[0]);
+ ds_put_c_format (str, "%.*g THRU HIGHEST",
+ DBL_DIG + 1, ov->v.range[0]);
break;
default:
g_warning ("Invalid type in old recode value");
static gchar *
num_to_string (gdouble x)
{
- return g_strdup_printf ("%g", x);
+ return g_strdup_printf ("%.*g", DBL_DIG + 1, x);
}
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2007, 2009, 2010, 2011, 2012 Free Software Foundation
+ Copyright (C) 2007, 2009, 2010, 2011, 2012, 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
#include <gtk/gtk.h>
+#include <float.h>
#include <xalloc.h>
#include <ui/gui/psppire-data-window.h>
#include <ui/gui/dialog-common.h>
{
case NV_NUMERIC:
{
- gchar *text = g_strdup_printf ("%g", nv->v.v);
+ gchar *text = g_strdup_printf ("%.*g", DBL_DIG + 1, nv->v.v);
g_value_set_string (dest, text);
g_free (text);
}
static gchar *
num_to_string (gdouble x)
{
- return g_strdup_printf ("%g", x);
+ return g_strdup_printf ("%.*g", DBL_DIG + 1, x);
}
/* Callback which gets called when a new row is selected
switch (nv->type)
{
case NV_NUMERIC:
- ds_put_c_format (dds, "%g", nv->v.v);
+ ds_put_c_format (dds, "%.*g", DBL_DIG + 1, nv->v.v);
break;
case NV_STRING:
syntax_gen_string (dds, ss_cstr (nv->v.s));
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2008, 2009, 2010, 2011, 2014 Free Software Foundation, Inc.
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
#include <config.h>
#include "select-cases-dialog.h"
+#include <float.h>
#include <gtk/gtk.h>
#include "executor.h"
#include "psppire-dialog.h"
gtk_spin_button_get_value (GTK_SPIN_BUTTON (scd->spinbutton));
ds_put_c_format (&dss,
- "COMPUTE %s = RV.UNIFORM (0,1) < %g.\n",
+ "COMPUTE %s = RV.UNIFORM (0,1) < %.*g.\n",
filter,
- percentage / 100.0 );
+ DBL_DIG + 1, percentage / 100.0 );
}
else
{
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2013 Free Software Foundation
+ Copyright (C) 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
#include <config.h>
+#include <float.h>
#include <gtk/gtk.h>
#include "psppire-spreadsheet-model.h"
const int width = caseproto_get_width (proto, i);
const union value *val = case_data_idx (c, i);
if (0 == width)
- printf ("%g ", val->f);
+ printf ("%.*g ", DBL_DIG + 1, val->f);
else
{
char *ss = xzalloc (width + 1);
/* PSPP - a program for statistical analysis.
- Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009, 2010, 2014 Free Software Foundation, Inc.
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
#include <data/datasheet.h>
#include <ctype.h>
+#include <float.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
{
if (width == 0)
mc_error (mc, "element %zu,%zu (of %zu,%zu) differs: "
- "%g != %g",
+ "%.*g != %.*g",
row, col, n_rows, n_columns,
- case_num_idx (c, col), array[row][col].f);
+ DBL_DIG + 1, case_num_idx (c, col),
+ DBL_DIG + 1, array[row][col].f);
else
mc_error (mc, "element %zu,%zu (of %zu,%zu) differs: "
"'%.*s' != '%.*s'",
{
if (width == 0)
mc_error (mc, "element %zu,%zu (of %zu,%zu) differs: "
- "%g != %g", row, col, n_rows, n_columns,
- v.f, av->f);
+ "%.*g != %.*g", row, col, n_rows, n_columns,
+ DBL_DIG + 1, v.f, DBL_DIG + 1, av->f);
else
mc_error (mc, "element %zu,%zu (of %zu,%zu) differs: "
"'%.*s' != '%.*s'",
* Numeric missing values.
MISSING VALUES date1 num1 (1).
+DISPLAY DICTIONARY date1 num1.
MISSING VALUES date1 num1 (1, 2).
+DISPLAY DICTIONARY date1 num1.
MISSING VALUES date1 num1 (1, 2, 3).
+DISPLAY DICTIONARY date1 num1.
+MISSING VALUES date1 num1 (9999998, 9999984, 3).
+DISPLAY DICTIONARY date1 num1.
* Numeric missing values using the first variable's format.
MISSING VALUES num1 date1 ('1').
+DISPLAY DICTIONARY date1 num1.
MISSING VALUES num1 date1 ('1', '2').
+DISPLAY DICTIONARY date1 num1.
MISSING VALUES num1 date1 ('1', '2', '3').
+DISPLAY DICTIONARY date1 num1.
MISSING VALUES date1 num1 ('06-AUG-05').
+DISPLAY DICTIONARY date1 num1.
MISSING VALUES date1 num1 ('06-AUG-05', '01-OCT-78').
+DISPLAY DICTIONARY date1 num1.
MISSING VALUES date1 num1 ('06-AUG-05', '01-OCT-78', '14-FEB-81').
+DISPLAY DICTIONARY date1 num1.
* Ranges of numeric missing values.
MISSING VALUES num1 (1 THRU 2).
+DISPLAY DICTIONARY num1.
MISSING VALUES num1 (LO THRU 2).
+DISPLAY DICTIONARY num1.
MISSING VALUES num1 (LOWEST THRU 2).
+DISPLAY DICTIONARY num1.
MISSING VALUES num1 (1 THRU HI).
+DISPLAY DICTIONARY num1.
MISSING VALUES num1 (1 THRU HIGHEST).
+DISPLAY DICTIONARY num1.
* A range of numeric missing values, plus an individual value.
MISSING VALUES num1 (1 THRU 2, 3).
+DISPLAY DICTIONARY num1.
MISSING VALUES num1 (LO THRU 2, 3).
+DISPLAY DICTIONARY num1.
MISSING VALUES num1 (LOWEST THRU 2, 3).
+DISPLAY DICTIONARY num1.
MISSING VALUES num1 (1 THRU HI, -1).
+DISPLAY DICTIONARY num1.
MISSING VALUES num1 (1 THRU HIGHEST, -1).
+DISPLAY DICTIONARY num1.
* String missing values.
MISSING VALUES str1 str2 longstr ('abc ','def').
+DISPLAY DICTIONARY str1 str2 longstr.
* May mix variable types when clearing missing values.
MISSING VALUES ALL ().
+DISPLAY DICTIONARY
+])
+AT_CHECK([pspp -o pspp.csv missing-values.sps])
+AT_CHECK([sed -n '/Format/s/,.*/:/p
+s/"//g
+s/^,Missing Values: \([[^,]]*\),.*/\1/p
+/^$/p' pspp.csv
+], [0], [dnl
+date1:
+1
+num1:
+1
+
+date1:
+1; 2
+num1:
+1; 2
+
+date1:
+1; 2; 3
+num1:
+1; 2; 3
+
+date1:
+9999998; 9999984; 3
+num1:
+9999998; 9999984; 3
+
+date1:
+1
+num1:
+1
+
+date1:
+1; 2
+num1:
+1; 2
+
+date1:
+1; 2; 3
+num1:
+1; 2; 3
+
+date1:
+13342665600
+num1:
+13342665600
+
+date1:
+13342665600; 12495427200
+num1:
+13342665600; 12495427200
+
+date1:
+13342665600; 12495427200; 12570336000
+num1:
+13342665600; 12495427200; 12570336000
+
+num1:
+1 THRU 2
+
+num1:
+LOWEST THRU 2
+
+num1:
+LOWEST THRU 2
+
+num1:
+1 THRU HIGHEST
+
+num1:
+1 THRU HIGHEST
+
+num1:
+1 THRU 2; 3
+
+num1:
+LOWEST THRU 2; 3
+
+num1:
+LOWEST THRU 2; 3
+
+num1:
+1 THRU HIGHEST; -1
+
+num1:
+1 THRU HIGHEST; -1
+
+str1:
+abc ; def @&t@
+str2:
+abc; def
+longstr:
+abc ; def @&t@
+
+str1:
+str2:
+date1:
+num1:
+longstr:
])
-AT_CHECK([pspp -O format=csv missing-values.sps])
AT_CLEANUP
AT_SETUP([MISSING VALUES invalid cases])
/* PSPP - a program for statistical analysis.
- Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
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
#include <ctype.h>
#include <errno.h>
+#include <float.h>
#include <getopt.h>
#include <inttypes.h>
#include <limits.h>
: "<error>");
printf ("\t%17s: %"PRId32"\n", "Weight index", weight_index);
printf ("\t%17s: %"PRId32"\n", "Number of cases", ncases);
- printf ("\t%17s: %g\n", "Compression bias", r->bias);
+ printf ("\t%17s: %.*g\n", "Compression bias", DBL_DIG + 1, r->bias);
printf ("\t%17s: %s\n", "Creation date", creation_date);
printf ("\t%17s: %s\n", "Creation time", creation_time);
printf ("\t%17s: \"%s\"\n", "File label", file_label);
{
double low = read_float (r);
double high = read_float (r);
- printf (" %g...%g", low, high);
+ printf (" %.*g...%.*g", DBL_DIG + 1, low, DBL_DIG + 1, high);
missing_value_code = -missing_value_code - 2;
}
for (i = 0; i < missing_value_code; i++)
- printf (" %g", read_float (r));
+ printf (" %.*g", DBL_DIG + 1, read_float (r));
}
else if (width > 0)
{
if (!isprint (raw_value[n_printable]))
break;
- printf ("%g/\"%.*s\"", value, n_printable, raw_value);
+ printf ("%.*g/\"%.*s\"", DBL_DIG + 1, value, n_printable, raw_value);
}
/* Reads value labels from sysfile R and inserts them into the
sys_error (r, "Bad size (%zu) or count (%zu) on extension 4.",
size, count);
- printf ("\tsysmis: %g (%a)\n", sysmis, sysmis);
+ printf ("\tsysmis: %.*g (%a)\n", DBL_DIG + 1, sysmis, sysmis);
if (sysmis != SYSMIS)
- sys_warn (r, "File specifies unexpected value %g (%a) as %s.",
- sysmis, sysmis, "SYSMIS");
+ sys_warn (r, "File specifies unexpected value %.*g (%a) as %s.",
+ DBL_DIG + 1, sysmis, sysmis, "SYSMIS");
- printf ("\thighest: %g (%a)\n", highest, highest);
+ printf ("\thighest: %.*g (%a)\n", DBL_DIG + 1, highest, highest);
if (highest != HIGHEST)
- sys_warn (r, "File specifies unexpected value %g (%a) as %s.",
- highest, highest, "HIGHEST");
+ sys_warn (r, "File specifies unexpected value %.*g (%a) as %s.",
+ DBL_DIG + 1, highest, highest, "HIGHEST");
- printf ("\tlowest: %g (%a)\n", lowest, lowest);
+ printf ("\tlowest: %.*g (%a)\n", DBL_DIG + 1, lowest, lowest);
if (lowest != LOWEST && lowest != SYSMIS)
- sys_warn (r, "File specifies unexpected value %g (%a) as %s.",
- lowest, lowest, "LOWEST");
+ sys_warn (r, "File specifies unexpected value %.*g (%a) as %s.",
+ DBL_DIG + 1, lowest, lowest, "LOWEST");
}
static void
switch (opcode)
{
default:
- printf ("%g", opcode - r->bias);
+ printf ("%.*g", DBL_DIG + 1, opcode - r->bias);
if (width != 0)
printf (", but this is a string variable (width=%d)", width);
printf ("\n");