diff -c -r --exclude=CVS cube/cube.c cube.new/cube.c *** cube/cube.c Thu Sep 12 00:26:00 2002 --- cube.new/cube.c Sun Nov 17 06:55:32 2002 *************** *** 25,30 **** --- 25,36 ---- extern int cube_yyparse(); /* + ** GUC variable used to control number of digits displayed. + */ + + extern int extra_float_digits; /* Added to DBL_DIG */ + + /* ** Input/Output routines */ NDBOX *cube_in(char *str); *************** *** 121,130 **** --- 127,143 ---- 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,139 **** { if (i > 0) appendStringInfo(&buf, ", "); ! appendStringInfo(&buf, "%.16g", cube->x[i]); if (cube->x[i] != cube->x[i + dim]) equal = false; } --- 146,152 ---- { if (i > 0) appendStringInfo(&buf, ", "); ! appendStringInfo(&buf, "%.*g", ndig, cube->x[i]); if (cube->x[i] != cube->x[i + dim]) equal = false; } *************** *** 146,152 **** { if (i > 0) appendStringInfo(&buf, ", "); ! appendStringInfo(&buf, "%.16g", cube->x[i + dim]); } appendStringInfoChar(&buf, ')'); } --- 159,165 ---- { if (i > 0) appendStringInfo(&buf, ", "); ! appendStringInfo(&buf, "%.*g", ndig, cube->x[i + dim]); } appendStringInfoChar(&buf, ')'); } diff -c -r --exclude=CVS cube/expected/cube.out cube.new/expected/cube.out *** cube/expected/cube.out Fri Nov 1 22:46:04 2002 --- cube.new/expected/cube.out Sun Nov 17 07:03:41 2002 *************** *** 145,183 **** (1 row) SELECT '1234567890123456'::cube AS cube; ! cube ! -------------------- ! (1234567890123456) (1 row) SELECT '+1234567890123456'::cube AS cube; ! cube ! -------------------- ! (1234567890123456) (1 row) SELECT '-1234567890123456'::cube AS cube; ! cube ! --------------------- ! (-1234567890123456) (1 row) SELECT '.1234567890123456'::cube AS cube; ! cube ! ---------------------- ! (0.1234567890123456) (1 row) SELECT '+.1234567890123456'::cube AS cube; ! cube ! ---------------------- ! (0.1234567890123456) (1 row) SELECT '-.1234567890123456'::cube AS cube; ! cube ! ----------------------- ! (-0.1234567890123456) (1 row) -- simple lists (points) --- 145,183 ---- (1 row) SELECT '1234567890123456'::cube AS cube; ! cube ! ------------------------ ! (1.23456789012346e+15) (1 row) SELECT '+1234567890123456'::cube AS cube; ! cube ! ------------------------ ! (1.23456789012346e+15) (1 row) SELECT '-1234567890123456'::cube AS cube; ! cube ! ------------------------- ! (-1.23456789012346e+15) (1 row) SELECT '.1234567890123456'::cube AS cube; ! cube ! --------------------- ! (0.123456789012346) (1 row) SELECT '+.1234567890123456'::cube AS cube; ! cube ! --------------------- ! (0.123456789012346) (1 row) SELECT '-.1234567890123456'::cube AS cube; ! cube ! ---------------------- ! (-0.123456789012346) (1 row) -- simple lists (points)