projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Parameter estimate matched with appropriate variable in linreg cache
[pspp]
/
src
/
data-out.c
diff --git
a/src/data-out.c
b/src/data-out.c
index d21d2902e1e5fcfe383b0872c1dabed27ef75c88..2600ccb8037dfac35af8494b60b6c5b23a6eaa9f 100644
(file)
--- a/
src/data-out.c
+++ b/
src/data-out.c
@@
-34,6
+34,9
@@
#include "str.h"
#include "var.h"
#include "str.h"
#include "var.h"
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
#include "debug-print.h"
\f
/* Public functions. */
#include "debug-print.h"
\f
/* Public functions. */
@@
-1116,6
+1119,7
@@
format_and_round (char *dst, double number, const struct fmt_spec *fp,
sprintf (buf, "%.*f", decimals, number);
sprintf (buf, "%.*f", decimals, number);
+ /* Omit integer part if it's 0. */
if (!memcmp (buf, "0.", 2))
memmove (buf, buf + 1, strlen (buf));
else if (!memcmp (buf, "-0.", 3))
if (!memcmp (buf, "0.", 2))
memmove (buf, buf + 1, strlen (buf));
else if (!memcmp (buf, "-0.", 3))
@@
-1215,6
+1219,10
@@
format_and_round (char *dst, double number, const struct fmt_spec *fp,
}
}
}
}
+ /* Omit `-' if value output is zero. */
+ if (buf[0] == '-' && buf[strspn (buf, "-.0")] == '\0')
+ memmove (buf, buf + 1, strlen (buf));
+
buf_copy_str_lpad (dst, fp->w, buf);
return 1;
}
buf_copy_str_lpad (dst, fp->w, buf);
return 1;
}