@@ -7,6 +7,82 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30');
77INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84');
88INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e+200');
99INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
10+ -- test for underflow and overflow
11+ INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
12+ ERROR: "10e400" is out of range for type double precision
13+ INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
14+ ERROR: "-10e400" is out of range for type double precision
15+ INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
16+ ERROR: "10e-400" is out of range for type double precision
17+ INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
18+ ERROR: "-10e-400" is out of range for type double precision
19+ -- bad input
20+ INSERT INTO FLOAT8_TBL(f1) VALUES (' ');
21+ ERROR: invalid input syntax for type double precision: " "
22+ INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
23+ ERROR: invalid input syntax for type double precision: "xyz"
24+ INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
25+ ERROR: invalid input syntax for type double precision: "5.0.0"
26+ INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
27+ ERROR: invalid input syntax for type double precision: "5 . 0"
28+ INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0');
29+ ERROR: invalid input syntax for type double precision: "5. 0"
30+ INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3');
31+ ERROR: invalid input syntax for type double precision: " - 3"
32+ INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5');
33+ ERROR: invalid input syntax for type double precision: "123 5"
34+ -- special inputs
35+ SELECT 'NaN'::float8;
36+ float8
37+ --------
38+ NaN
39+ (1 row)
40+
41+ SELECT 'nan'::float8;
42+ float8
43+ --------
44+ NaN
45+ (1 row)
46+
47+ SELECT ' NAN '::float8;
48+ float8
49+ --------
50+ NaN
51+ (1 row)
52+
53+ SELECT 'infinity'::float8;
54+ float8
55+ ----------
56+ Infinity
57+ (1 row)
58+
59+ SELECT ' -INFINiTY '::float8;
60+ float8
61+ -----------
62+ -Infinity
63+ (1 row)
64+
65+ -- bad special inputs
66+ SELECT 'N A N'::float8;
67+ ERROR: invalid input syntax for type double precision: "N A N"
68+ SELECT 'NaN x'::float8;
69+ ERROR: invalid input syntax for type double precision: "NaN x"
70+ SELECT ' INFINITY x'::float8;
71+ ERROR: invalid input syntax for type double precision: " INFINITY x"
72+ SELECT 'Infinity'::float8 + 100.0;
73+ ERROR: type "double precision" value out of range: overflow
74+ SELECT 'Infinity'::float8 / 'Infinity'::float8;
75+ ?column?
76+ ----------
77+ NaN
78+ (1 row)
79+
80+ SELECT 'nan'::float8 / 'nan'::float8;
81+ ?column?
82+ ----------
83+ NaN
84+ (1 row)
85+
1086SELECT '' AS five, FLOAT8_TBL.*;
1187 five | f1
1288------+----------------------
0 commit comments