mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Add some regression test cases for denormalized float8 input.
This was submitted with the previous patch, but I'm committing it separately to ease backing it out if these results prove too unportable. Marti Raudsepp, after a proposal by Jeroen Vermeulen
This commit is contained in:
@ -24,6 +24,25 @@ SELECT '-10e-400'::float8;
|
||||
ERROR: "-10e-400" is out of range for type double precision
|
||||
LINE 1: SELECT '-10e-400'::float8;
|
||||
^
|
||||
-- test whether denormalized values are accepted
|
||||
SELECT '4.95e-324'::float8 < '1.49e-323'::float8;
|
||||
?column?
|
||||
----------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '4.95e-324'::float8 > '0'::float8;
|
||||
?column?
|
||||
----------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT substr('-4.95e-324'::float8::text, 1, 4);
|
||||
substr
|
||||
--------
|
||||
-4.9
|
||||
(1 row)
|
||||
|
||||
-- bad input
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES ('');
|
||||
ERROR: invalid input syntax for type double precision: ""
|
||||
|
@ -24,6 +24,25 @@ SELECT '10e-400'::float8;
|
||||
|
||||
SELECT '-10e-400'::float8;
|
||||
float8
|
||||
-- test whether denormalized values are accepted
|
||||
SELECT '4.95e-324'::float8 < '1.49e-323'::float8;
|
||||
?column?
|
||||
----------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '4.95e-324'::float8 > '0'::float8;
|
||||
?column?
|
||||
----------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT substr('-4.95e-324'::float8::text, 1, 4);
|
||||
substr
|
||||
--------
|
||||
-4.9
|
||||
(1 row)
|
||||
|
||||
--------
|
||||
-0
|
||||
(1 row)
|
||||
|
@ -24,6 +24,25 @@ SELECT '10e-400'::float8;
|
||||
|
||||
SELECT '-10e-400'::float8;
|
||||
float8
|
||||
-- test whether denormalized values are accepted
|
||||
SELECT '4.95e-324'::float8 < '1.49e-323'::float8;
|
||||
?column?
|
||||
----------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '4.95e-324'::float8 > '0'::float8;
|
||||
?column?
|
||||
----------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT substr('-4.95e-324'::float8::text, 1, 4);
|
||||
substr
|
||||
--------
|
||||
-4.9
|
||||
(1 row)
|
||||
|
||||
--------
|
||||
0
|
||||
(1 row)
|
||||
|
@ -24,6 +24,25 @@ SELECT '-10e-400'::float8;
|
||||
ERROR: "-10e-400" is out of range for type double precision
|
||||
LINE 1: SELECT '-10e-400'::float8;
|
||||
^
|
||||
-- test whether denormalized values are accepted
|
||||
SELECT '4.95e-324'::float8 < '1.49e-323'::float8;
|
||||
?column?
|
||||
----------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '4.95e-324'::float8 > '0'::float8;
|
||||
?column?
|
||||
----------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT substr('-4.95e-324'::float8::text, 1, 4);
|
||||
substr
|
||||
--------
|
||||
-4.9
|
||||
(1 row)
|
||||
|
||||
-- bad input
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES ('');
|
||||
ERROR: invalid input syntax for type double precision: ""
|
||||
|
@ -16,6 +16,11 @@ SELECT '-10e400'::float8;
|
||||
SELECT '10e-400'::float8;
|
||||
SELECT '-10e-400'::float8;
|
||||
|
||||
-- test whether denormalized values are accepted
|
||||
SELECT '4.95e-324'::float8 < '1.49e-323'::float8;
|
||||
SELECT '4.95e-324'::float8 > '0'::float8;
|
||||
SELECT substr('-4.95e-324'::float8::text, 1, 4);
|
||||
|
||||
-- bad input
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES ('');
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
|
||||
|
Reference in New Issue
Block a user