Changed double output.

This commit is contained in:
Michael Meskes 2006-08-26 11:50:00 +00:00
parent 32883a5d3c
commit 445a61297e
3 changed files with 16 additions and 16 deletions

View File

@ -100,7 +100,7 @@ main(void)
r = dectodbl(dec, &dbl); r = dectodbl(dec, &dbl);
if (r) check_errno(); if (r) check_errno();
printf("dec[%d,10]: %2.7f (r: %d)\n", i, r?0.0:dbl, r); printf("dec[%d,10]: %g (r: %d)\n", i, r?0.0:dbl, r);
PGTYPESdecimal_free(din); PGTYPESdecimal_free(din);
printf("\n"); printf("\n");

View File

@ -120,7 +120,7 @@ main(void)
r = dectodbl(dec, &dbl); r = dectodbl(dec, &dbl);
if (r) check_errno(); if (r) check_errno();
printf("dec[%d,10]: %2.7f (r: %d)\n", i, r?0.0:dbl, r); printf("dec[%d,10]: %g (r: %d)\n", i, r?0.0:dbl, r);
PGTYPESdecimal_free(din); PGTYPESdecimal_free(din);
printf("\n"); printf("\n");

View File

@ -5,7 +5,7 @@
dec[0,5]: r: 0, 0.00 dec[0,5]: r: 0, 0.00
(errno == PGTYPES_NUM_OVERFLOW) - dec[0,6]: 0 (r: -1) (errno == PGTYPES_NUM_OVERFLOW) - dec[0,6]: 0 (r: -1)
(errno == PGTYPES_NUM_OVERFLOW) - dec[0,8]: 0 (r: -1) (errno == PGTYPES_NUM_OVERFLOW) - dec[0,8]: 0 (r: -1)
(errno == PGTYPES_NUM_OVERFLOW) - dec[0,10]: 0.0000000 (r: -1) (errno == PGTYPES_NUM_OVERFLOW) - dec[0,10]: 0 (r: -1)
dec[1,1]: r: 0, -2 dec[1,1]: r: 0, -2
dec[1,2]: r: 0, -2 dec[1,2]: r: 0, -2
@ -16,7 +16,7 @@ dec[1,6]: -2 (r: 0)
dec[1,7]: -2.00 (r: 0 - cmp: 0) dec[1,7]: -2.00 (r: 0 - cmp: 0)
dec[1,8]: -2 (r: 0) dec[1,8]: -2 (r: 0)
dec[1,9]: -2.00 (r: 0 - cmp: 0) dec[1,9]: -2.00 (r: 0 - cmp: 0)
dec[1,10]: -2.0000000 (r: 0) dec[1,10]: -2 (r: 0)
dec[2,1]: r: 0, 0.794 dec[2,1]: r: 0, 0.794
dec[2,2]: r: 0, 1 dec[2,2]: r: 0, 1
@ -27,7 +27,7 @@ dec[2,6]: 1 (r: 0)
dec[2,7]: 1.00 (r: 0 - cmp: -1) dec[2,7]: 1.00 (r: 0 - cmp: -1)
dec[2,8]: 1 (r: 0) dec[2,8]: 1 (r: 0)
dec[2,9]: 1.00 (r: 0 - cmp: -1) dec[2,9]: 1.00 (r: 0 - cmp: -1)
dec[2,10]: 0.7940000 (r: 0) dec[2,10]: 0.794 (r: 0)
dec[3,1]: r: 0, 3.44 dec[3,1]: r: 0, 3.44
dec[3,2]: r: 0, 3 dec[3,2]: r: 0, 3
@ -38,7 +38,7 @@ dec[3,6]: 3 (r: 0)
dec[3,7]: 3.00 (r: 0 - cmp: 1) dec[3,7]: 3.00 (r: 0 - cmp: 1)
dec[3,8]: 3 (r: 0) dec[3,8]: 3 (r: 0)
dec[3,9]: 3.00 (r: 0 - cmp: 1) dec[3,9]: 3.00 (r: 0 - cmp: 1)
dec[3,10]: 3.4400000 (r: 0) dec[3,10]: 3.44 (r: 0)
dec[4,1]: r: 0, 592490000000000000000000 dec[4,1]: r: 0, 592490000000000000000000
dec[4,2]: r: 0, 592490000000000000000000 dec[4,2]: r: 0, 592490000000000000000000
@ -47,7 +47,7 @@ dec[4,4]: r: 0, 592490000000000000000000.00
dec[4,5]: r: 0, 0.00 dec[4,5]: r: 0, 0.00
(errno == PGTYPES_NUM_OVERFLOW) - dec[4,6]: 0 (r: -1) (errno == PGTYPES_NUM_OVERFLOW) - dec[4,6]: 0 (r: -1)
(errno == PGTYPES_NUM_OVERFLOW) - dec[4,8]: 0 (r: -1) (errno == PGTYPES_NUM_OVERFLOW) - dec[4,8]: 0 (r: -1)
dec[4,10]: 592490000000000009961472.0000000 (r: 0) dec[4,10]: 5.9249e+23 (r: 0)
dec[5,1]: r: 0, -328400 dec[5,1]: r: 0, -328400
dec[5,2]: r: 0, -328400 dec[5,2]: r: 0, -328400
@ -58,7 +58,7 @@ dec[5,6]: -328400 (r: 0)
dec[5,7]: -328400.00 (r: 0 - cmp: 0) dec[5,7]: -328400.00 (r: 0 - cmp: 0)
dec[5,8]: -328400 (r: 0) dec[5,8]: -328400 (r: 0)
dec[5,9]: -328400.00 (r: 0 - cmp: 0) dec[5,9]: -328400.00 (r: 0 - cmp: 0)
dec[5,10]: -328400.0000000 (r: 0) dec[5,10]: -328400 (r: 0)
(no errno set) - dec[6,1]: r: -1, * (no errno set) - dec[6,1]: r: -1, *
dec[6,2]: r: 0, 0 dec[6,2]: r: 0, 0
@ -69,7 +69,7 @@ dec[6,6]: 0 (r: 0)
dec[6,7]: 0.00 (r: 0 - cmp: 1) dec[6,7]: 0.00 (r: 0 - cmp: 1)
dec[6,8]: 0 (r: 0) dec[6,8]: 0 (r: 0)
dec[6,9]: 0.00 (r: 0 - cmp: 1) dec[6,9]: 0.00 (r: 0 - cmp: 1)
(errno == PGTYPES_NUM_UNDERFLOW) - dec[6,10]: 0.0000000 (r: -1) (errno == PGTYPES_NUM_UNDERFLOW) - dec[6,10]: 0 (r: -1)
dec[7,1]: r: 0, 0.001 dec[7,1]: r: 0, 0.001
dec[7,2]: r: 0, 0 dec[7,2]: r: 0, 0
@ -80,7 +80,7 @@ dec[7,6]: 0 (r: 0)
dec[7,7]: 0.00 (r: 0 - cmp: 1) dec[7,7]: 0.00 (r: 0 - cmp: 1)
dec[7,8]: 0 (r: 0) dec[7,8]: 0 (r: 0)
dec[7,9]: 0.00 (r: 0 - cmp: 1) dec[7,9]: 0.00 (r: 0 - cmp: 1)
dec[7,10]: 0.0010000 (r: 0) dec[7,10]: 0.001 (r: 0)
dec[8,1]: r: 0, 0.0 dec[8,1]: r: 0, 0.0
dec[8,2]: r: 0, 0 dec[8,2]: r: 0, 0
@ -91,7 +91,7 @@ dec[8,6]: 0 (r: 0)
dec[8,7]: 0.00 (r: 0 - cmp: 0) dec[8,7]: 0.00 (r: 0 - cmp: 0)
dec[8,8]: 0 (r: 0) dec[8,8]: 0 (r: 0)
dec[8,9]: 0.00 (r: 0 - cmp: 0) dec[8,9]: 0.00 (r: 0 - cmp: 0)
dec[8,10]: 0.0000000 (r: 0) dec[8,10]: 0 (r: 0)
dec[9,1]: r: 0, -0.000059249 dec[9,1]: r: 0, -0.000059249
dec[9,2]: r: 0, -0 dec[9,2]: r: 0, -0
@ -102,7 +102,7 @@ dec[9,6]: 0 (r: 0)
dec[9,7]: 0.00 (r: 0 - cmp: -1) dec[9,7]: 0.00 (r: 0 - cmp: -1)
dec[9,8]: 0 (r: 0) dec[9,8]: 0 (r: 0)
dec[9,9]: 0.00 (r: 0 - cmp: -1) dec[9,9]: 0.00 (r: 0 - cmp: -1)
dec[9,10]: -0.0000592 (r: 0) dec[9,10]: -5.9249e-05 (r: 0)
dec[10,1]: r: 0, 0.003284 dec[10,1]: r: 0, 0.003284
dec[10,2]: r: 0, 0 dec[10,2]: r: 0, 0
@ -113,7 +113,7 @@ dec[10,6]: 0 (r: 0)
dec[10,7]: 0.00 (r: 0 - cmp: 1) dec[10,7]: 0.00 (r: 0 - cmp: 1)
dec[10,8]: 0 (r: 0) dec[10,8]: 0 (r: 0)
dec[10,9]: 0.00 (r: 0 - cmp: 1) dec[10,9]: 0.00 (r: 0 - cmp: 1)
dec[10,10]: 0.0032840 (r: 0) dec[10,10]: 0.003284 (r: 0)
dec[11,1]: r: 0, 0.500001 dec[11,1]: r: 0, 0.500001
dec[11,2]: r: 0, 1 dec[11,2]: r: 0, 1
@ -124,7 +124,7 @@ dec[11,6]: 1 (r: 0)
dec[11,7]: 1.00 (r: 0 - cmp: -1) dec[11,7]: 1.00 (r: 0 - cmp: -1)
dec[11,8]: 1 (r: 0) dec[11,8]: 1 (r: 0)
dec[11,9]: 1.00 (r: 0 - cmp: -1) dec[11,9]: 1.00 (r: 0 - cmp: -1)
dec[11,10]: 0.5000010 (r: 0) dec[11,10]: 0.500001 (r: 0)
dec[12,1]: r: 0, -0.5000001 dec[12,1]: r: 0, -0.5000001
dec[12,2]: r: 0, -1 dec[12,2]: r: 0, -1
@ -135,7 +135,7 @@ dec[12,6]: -1 (r: 0)
dec[12,7]: -1.00 (r: 0 - cmp: 1) dec[12,7]: -1.00 (r: 0 - cmp: 1)
dec[12,8]: -1 (r: 0) dec[12,8]: -1 (r: 0)
dec[12,9]: -1.00 (r: 0 - cmp: 1) dec[12,9]: -1.00 (r: 0 - cmp: 1)
dec[12,10]: -0.5000001 (r: 0) dec[12,10]: -0.5 (r: 0)
dec[13,1]: r: 0, 1234567890123456789012345678.91 dec[13,1]: r: 0, 1234567890123456789012345678.91
dec[13,2]: r: 0, 1234567890123456789012345679 dec[13,2]: r: 0, 1234567890123456789012345679
@ -144,7 +144,7 @@ dec[13,4]: r: 0, 1234567890123456789012345678.91
dec[13,5]: r: 0, 0.00 dec[13,5]: r: 0, 0.00
(errno == PGTYPES_NUM_OVERFLOW) - dec[13,6]: 0 (r: -1) (errno == PGTYPES_NUM_OVERFLOW) - dec[13,6]: 0 (r: -1)
(errno == PGTYPES_NUM_OVERFLOW) - dec[13,8]: 0 (r: -1) (errno == PGTYPES_NUM_OVERFLOW) - dec[13,8]: 0 (r: -1)
dec[13,10]: 1234567890123456850245451776.0000000 (r: 0) dec[13,10]: 1.23457e+27 (r: 0)
(errno == PGTYPES_NUM_OVERFLOW) - dec[14,0]: r: -1200 (errno == PGTYPES_NUM_OVERFLOW) - dec[14,0]: r: -1200
(errno == PGTYPES_NUM_BAD_NUMERIC) - dec[15,0]: r: -1213 (errno == PGTYPES_NUM_BAD_NUMERIC) - dec[15,0]: r: -1213