aboutsummaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/profile.c b/profile.c
index 74fc4f9c..5af7b929 100644
--- a/profile.c
+++ b/profile.c
@@ -1343,9 +1343,19 @@ pp_number(NODE *n)
} else
#endif
{
- count = PP_PRECISION + 10;
- emalloc(str, char *, count, "pp_number");
- sprintf(str, "%0.*g", PP_PRECISION, n->numbr);
+ /* Use format_val() to get integral values printed as integers */
+ NODE *s;
+
+ getnode(s);
+ *s = *n;
+ s->flags &= ~STRCUR;
+
+ s = r_format_val("%.6g", 0, s);
+
+ s->stptr[s->stlen] = '\0';
+ str = s->stptr;
+
+ freenode(s);
}
return str;