projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change many %g format specifiers to %.*g with precision DBL_DIG + 1.
[pspp]
/
src
/
language
/
dictionary
/
sys-file-info.c
diff --git
a/src/language/dictionary/sys-file-info.c
b/src/language/dictionary/sys-file-info.c
index d26c236e8f026337e31e01b1fe02489375108842..2fdbdaf3c2a1609107bbb1ff9e81325407978555 100644
(file)
--- a/
src/language/dictionary/sys-file-info.c
+++ b/
src/language/dictionary/sys-file-info.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* 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
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
@@
-17,6
+17,7
@@
#include <config.h>
#include <ctype.h>
#include <config.h>
#include <ctype.h>
+#include <float.h>
#include <stdlib.h>
#include "data/attributes.h"
#include <stdlib.h>
#include "data/attributes.h"
@@
-406,19
+407,19
@@
display_attributes (struct tab_table *t, const struct attrset *set, int flags,
const struct attribute *attr = attrs[i];
const char *name = attribute_get_name (attr);
size_t n_values;
const struct attribute *attr = attrs[i];
const char *name = attribute_get_name (attr);
size_t n_values;
- size_t
i
;
+ size_t
j
;
if (!(flags & DF_AT_ATTRIBUTES) && is_at_name (name))
continue;
n_values = attribute_get_n_values (attr);
if (!(flags & DF_AT_ATTRIBUTES) && is_at_name (name))
continue;
n_values = attribute_get_n_values (attr);
- for (
i = 0; i < n_values; i
++)
+ for (
j = 0; j < n_values; j
++)
{
if (n_values > 1)
{
if (n_values > 1)
- tab_text_format (t, c, r, TAB_LEFT, "%s[%zu]", name,
i
+ 1);
+ tab_text_format (t, c, r, TAB_LEFT, "%s[%zu]", name,
j
+ 1);
else
tab_text (t, c, r, TAB_LEFT, name);
else
tab_text (t, c, r, TAB_LEFT, name);
- tab_text (t, c + 1, r, TAB_LEFT, attribute_get_value (attr,
i
));
+ tab_text (t, c + 1, r, TAB_LEFT, attribute_get_value (attr,
j
));
r++;
}
}
r++;
}
}
@@
-560,11
+561,13
@@
describe_variable (const struct variable *v, struct tab_table *t, int r,
double x, y;
mv_get_range (mv, &x, &y);
if (x == LOWEST)
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)
else if (y == HIGHEST)
- cp += sprintf (cp, "%
g THRU HIGHEST"
, x);
+ cp += sprintf (cp, "%
.*g THRU HIGHEST", DBL_DIG + 1
, x);
else
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++)
cnt++;
}
for (i = 0; i < mv_n_values (mv); i++)
@@
-573,7
+576,7
@@
describe_variable (const struct variable *v, struct tab_table *t, int r,
if (cnt++ > 0)
cp += sprintf (cp, "; ");
if (var_is_numeric (v))
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);
else
{
int width = var_get_width (v);