mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
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
This commit is contained in:
parent
349d529abf
commit
4987ca2d88
@ -121,9 +121,16 @@ cube_out(NDBOX * cube)
|
|||||||
bool equal = true;
|
bool equal = true;
|
||||||
int dim = cube->dim;
|
int dim = cube->dim;
|
||||||
int i;
|
int i;
|
||||||
|
int ndig;
|
||||||
|
|
||||||
initStringInfo(&buf);
|
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
|
* while printing the first (LL) corner, check if it is equal to the
|
||||||
* second one
|
* second one
|
||||||
@ -133,7 +140,7 @@ cube_out(NDBOX * cube)
|
|||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
appendStringInfo(&buf, ", ");
|
appendStringInfo(&buf, ", ");
|
||||||
appendStringInfo(&buf, "%.16g", cube->x[i]);
|
appendStringInfo(&buf, "%.*g", ndig, cube->x[i]);
|
||||||
if (cube->x[i] != cube->x[i + dim])
|
if (cube->x[i] != cube->x[i + dim])
|
||||||
equal = false;
|
equal = false;
|
||||||
}
|
}
|
||||||
@ -146,7 +153,7 @@ cube_out(NDBOX * cube)
|
|||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
appendStringInfo(&buf, ", ");
|
appendStringInfo(&buf, ", ");
|
||||||
appendStringInfo(&buf, "%.16g", cube->x[i + dim]);
|
appendStringInfo(&buf, "%.*g", ndig, cube->x[i + dim]);
|
||||||
}
|
}
|
||||||
appendStringInfoChar(&buf, ')');
|
appendStringInfoChar(&buf, ')');
|
||||||
}
|
}
|
||||||
|
@ -146,38 +146,38 @@ SELECT '-1e-700'::cube AS cube;
|
|||||||
|
|
||||||
SELECT '1234567890123456'::cube AS cube;
|
SELECT '1234567890123456'::cube AS cube;
|
||||||
cube
|
cube
|
||||||
--------------------
|
------------------------
|
||||||
(1234567890123456)
|
(1.23456789012346e+15)
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT '+1234567890123456'::cube AS cube;
|
SELECT '+1234567890123456'::cube AS cube;
|
||||||
cube
|
cube
|
||||||
--------------------
|
------------------------
|
||||||
(1234567890123456)
|
(1.23456789012346e+15)
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT '-1234567890123456'::cube AS cube;
|
SELECT '-1234567890123456'::cube AS cube;
|
||||||
cube
|
cube
|
||||||
---------------------
|
-------------------------
|
||||||
(-1234567890123456)
|
(-1.23456789012346e+15)
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT '.1234567890123456'::cube AS cube;
|
SELECT '.1234567890123456'::cube AS cube;
|
||||||
cube
|
cube
|
||||||
----------------------
|
---------------------
|
||||||
(0.1234567890123456)
|
(0.123456789012346)
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT '+.1234567890123456'::cube AS cube;
|
SELECT '+.1234567890123456'::cube AS cube;
|
||||||
cube
|
cube
|
||||||
----------------------
|
---------------------
|
||||||
(0.1234567890123456)
|
(0.123456789012346)
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT '-.1234567890123456'::cube AS cube;
|
SELECT '-.1234567890123456'::cube AS cube;
|
||||||
cube
|
cube
|
||||||
-----------------------
|
----------------------
|
||||||
(-0.1234567890123456)
|
(-0.123456789012346)
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- simple lists (points)
|
-- simple lists (points)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user