1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-29 13:56:47 +03:00

to_char(float4/8): don't print "junk" digits

Commit cc0d90b73b2e6dd2f301d46818a7265742c41a14 also avoids printing
junk digits, which are digits that are beyond the precision of the
underlying type.
This commit is contained in:
Bruce Momjian 2015-03-21 21:50:03 -04:00
parent cc0d90b73b
commit 9d61b9953c
2 changed files with 2 additions and 2 deletions

View File

@ -1539,7 +1539,7 @@ SELECT to_char(float8 '1.123456789123456789', '9.' || repeat('9', 55));
(1 row) (1 row)
SELECT to_char(float8 '1999999999999999999999999999999999999999999999.123456789123456789', SELECT to_char(float8 '1999999999999999999999999999999999999999999999.123456789123456789',
repeat('9', 50) || '.' || repeat('9', 50)); repeat('9', 50) || '.' || repeat('9', 50));
to_char to_char
-------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------
1999999999999990000000000000000000000000000000.00000000000000000000000000000000000000000000000000 1999999999999990000000000000000000000000000000.00000000000000000000000000000000000000000000000000

View File

@ -870,7 +870,7 @@ SELECT to_char(float8 '1e20','999999999999999999999D9');
SELECT to_char(1e20, '999999999999999999999D9'); SELECT to_char(1e20, '999999999999999999999D9');
SELECT to_char(float8 '1.123456789123456789', '9.' || repeat('9', 55)); SELECT to_char(float8 '1.123456789123456789', '9.' || repeat('9', 55));
SELECT to_char(float8 '1999999999999999999999999999999999999999999999.123456789123456789', SELECT to_char(float8 '1999999999999999999999999999999999999999999999.123456789123456789',
repeat('9', 50) || '.' || repeat('9', 50)); repeat('9', 50) || '.' || repeat('9', 50));
SELECT to_char(float8 '0.1', '9D' || repeat('9', 1000)); SELECT to_char(float8 '0.1', '9D' || repeat('9', 1000));
SELECT to_char(int4 '1', '9D' || repeat('9', 1000) || 'EEEE'); SELECT to_char(int4 '1', '9D' || repeat('9', 1000) || 'EEEE');
SELECT to_char(float4 '1', '9D' || repeat('9', 1000) || 'EEEE'); SELECT to_char(float4 '1', '9D' || repeat('9', 1000) || 'EEEE');