double precisoin type
Hello,
postgres [1264904]=# select 123456789.123456789123456::double precision;
┌────────────────────┐
│ float8 │
├────────────────────┤
│ 123456789.12345679 │
└────────────────────┘
(1 row)
I do not understand why this number is truncated at 123456789.12345679 that
is 17 digits and not 15 digits
Any idea
Fabrice
Documentation says:
double precision 8 bytes variable-precision, inexact 15 decimal digits
precision
Fabrice Chapuis <fabrice636861@gmail.com> writes:
Documentation says:
double precision 8 bytes variable-precision, inexact 15 decimal digits
precision
The documentation is stating the minimum number of decimal digits
that will be accurately reproduced. You got 16 reproduced correctly
in this example, but you were lucky.
float8out has a different rule, which is to emit enough digits to
describe the actually-stored binary value unambiguously, so that
dump and reload will not change the stored value.
regards, tom lane