diff options
author | Bruce Momjian | 2002-11-23 03:50:21 +0000 |
---|---|---|
committer | Bruce Momjian | 2002-11-23 03:50:21 +0000 |
commit | 4987ca2d888cb544a0d4edd6c9db63f04e194d3c (patch) | |
tree | 7a966e9a7cc976581cde37475aedc9f68bd96830 /contrib/cube/cube.c | |
parent | 349d529abf6ccd0caa8bf7d3fb4cfe959c4f47a3 (diff) |
This is a patch to make cube output work like double precision output
with regard to the extra_float_digits setting.
Since builtins.h was already included, I just deleted the extern
statement (and accompaning comments).
Bruno Wolff III
Diffstat (limited to 'contrib/cube/cube.c')
-rw-r--r-- | contrib/cube/cube.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c index 98c6167e62..d24d0f5593 100644 --- a/contrib/cube/cube.c +++ b/contrib/cube/cube.c @@ -121,10 +121,17 @@ cube_out(NDBOX * cube) bool equal = true; int dim = cube->dim; int i; + int ndig; initStringInfo(&buf); /* + * Get the number of digits to display. + */ + ndig = DBL_DIG + extra_float_digits; + if (ndig < 1) ndig = 1; + + /* * while printing the first (LL) corner, check if it is equal to the * second one */ @@ -133,7 +140,7 @@ cube_out(NDBOX * cube) { if (i > 0) appendStringInfo(&buf, ", "); - appendStringInfo(&buf, "%.16g", cube->x[i]); + appendStringInfo(&buf, "%.*g", ndig, cube->x[i]); if (cube->x[i] != cube->x[i + dim]) equal = false; } @@ -146,7 +153,7 @@ cube_out(NDBOX * cube) { if (i > 0) appendStringInfo(&buf, ", "); - appendStringInfo(&buf, "%.16g", cube->x[i + dim]); + appendStringInfo(&buf, "%.*g", ndig, cube->x[i + dim]); } appendStringInfoChar(&buf, ')'); } |