Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit500cf66

Browse files
committed
Add some regression test cases for denormalized float8 input.
This was submitted with the previous patch, but I'm committing itseparately to ease backing it out if these results prove too unportable.Marti Raudsepp, after a proposal by Jeroen Vermeulen
1 parentc318aee commit500cf66

File tree

5 files changed

+81
-0
lines changed

5 files changed

+81
-0
lines changed

‎src/test/regress/expected/float8-exp-three-digits-win32.out

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ SELECT '-10e-400'::float8;
2424
ERROR: "-10e-400" is out of range for type double precision
2525
LINE 1: SELECT '-10e-400'::float8;
2626
^
27+
-- test whether denormalized values are accepted
28+
SELECT '4.95e-324'::float8 < '1.49e-323'::float8;
29+
?column?
30+
----------
31+
t
32+
(1 row)
33+
34+
SELECT '4.95e-324'::float8 > '0'::float8;
35+
?column?
36+
----------
37+
t
38+
(1 row)
39+
40+
SELECT substr('-4.95e-324'::float8::text, 1, 4);
41+
substr
42+
--------
43+
-4.9
44+
(1 row)
45+
2746
-- bad input
2847
INSERT INTO FLOAT8_TBL(f1) VALUES ('');
2948
ERROR: invalid input syntax for type double precision: ""

‎src/test/regress/expected/float8-small-is-zero.out

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ SELECT '10e-400'::float8;
2424

2525
SELECT '-10e-400'::float8;
2626
float8
27+
-- test whether denormalized values are accepted
28+
SELECT '4.95e-324'::float8 < '1.49e-323'::float8;
29+
?column?
30+
----------
31+
t
32+
(1 row)
33+
34+
SELECT '4.95e-324'::float8 > '0'::float8;
35+
?column?
36+
----------
37+
t
38+
(1 row)
39+
40+
SELECT substr('-4.95e-324'::float8::text, 1, 4);
41+
substr
42+
--------
43+
-4.9
44+
(1 row)
45+
2746
--------
2847
-0
2948
(1 row)

‎src/test/regress/expected/float8-small-is-zero_1.out

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ SELECT '10e-400'::float8;
2424

2525
SELECT '-10e-400'::float8;
2626
float8
27+
-- test whether denormalized values are accepted
28+
SELECT '4.95e-324'::float8 < '1.49e-323'::float8;
29+
?column?
30+
----------
31+
t
32+
(1 row)
33+
34+
SELECT '4.95e-324'::float8 > '0'::float8;
35+
?column?
36+
----------
37+
t
38+
(1 row)
39+
40+
SELECT substr('-4.95e-324'::float8::text, 1, 4);
41+
substr
42+
--------
43+
-4.9
44+
(1 row)
45+
2746
--------
2847
0
2948
(1 row)

‎src/test/regress/expected/float8.out

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ SELECT '-10e-400'::float8;
2424
ERROR: "-10e-400" is out of range for type double precision
2525
LINE 1: SELECT '-10e-400'::float8;
2626
^
27+
-- test whether denormalized values are accepted
28+
SELECT '4.95e-324'::float8 < '1.49e-323'::float8;
29+
?column?
30+
----------
31+
t
32+
(1 row)
33+
34+
SELECT '4.95e-324'::float8 > '0'::float8;
35+
?column?
36+
----------
37+
t
38+
(1 row)
39+
40+
SELECT substr('-4.95e-324'::float8::text, 1, 4);
41+
substr
42+
--------
43+
-4.9
44+
(1 row)
45+
2746
-- bad input
2847
INSERT INTO FLOAT8_TBL(f1) VALUES ('');
2948
ERROR: invalid input syntax for type double precision: ""

‎src/test/regress/sql/float8.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ SELECT '-10e400'::float8;
1616
SELECT'10e-400'::float8;
1717
SELECT'-10e-400'::float8;
1818

19+
-- test whether denormalized values are accepted
20+
SELECT'4.95e-324'::float8<'1.49e-323'::float8;
21+
SELECT'4.95e-324'::float8>'0'::float8;
22+
SELECT substr('-4.95e-324'::float8::text,1,4);
23+
1924
-- bad input
2025
INSERT INTO FLOAT8_TBL(f1)VALUES ('');
2126
INSERT INTO FLOAT8_TBL(f1)VALUES ('');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp