]> granicus.if.org Git - postgresql/commitdiff
Update the float8 regression tests: they should now pass on FreeBSD 4.x
authorNeil Conway <neilc@samurai.com>
Wed, 24 Mar 2004 02:02:27 +0000 (02:02 +0000)
committerNeil Conway <neilc@samurai.com>
Wed, 24 Mar 2004 02:02:27 +0000 (02:02 +0000)
and (in theory) QNX. Thanks to Chris KL for the report.

src/test/regress/expected/float8-exp-three-digits-win32.out
src/test/regress/expected/float8-exp-three-digits.out
src/test/regress/expected/float8-small-is-zero.out
src/test/regress/expected/float8.out
src/test/regress/sql/float8.sql

index db72898ba7128ed00106411f9c52b3fa2907fbb5..e64a46399aeb3a9fe15dd2987e8416cdb01537e5 100644 (file)
@@ -7,14 +7,14 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30');
 INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84');
 INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e+200');
 INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
--- test for underflow and overflow
-INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
+-- test for underflow and overflow handling
+SELECT '10e400'::float8;
 ERROR:  "10e400" is out of range for type double precision
-INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
+SELECT '-10e400'::float8;
 ERROR:  "-10e400" is out of range for type double precision
-INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
+SELECT '10e-400'::float8;
 ERROR:  "10e-400" is out of range for type double precision
-INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
+SELECT '-10e-400'::float8;
 ERROR:  "-10e-400" is out of range for type double precision
 -- bad input
 INSERT INTO FLOAT8_TBL(f1) VALUES ('     ');
index 8113a3bda87099e7881d94aff61a05e8b8eb8d9a..7cfa2bec168db8142c6453819fbcee65d21d8532 100644 (file)
@@ -2,11 +2,86 @@
 -- FLOAT8
 --
 CREATE TABLE FLOAT8_TBL(f1 float8);
-INSERT INTO FLOAT8_TBL(f1) VALUES ('0.0');
-INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30');
-INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84');
+INSERT INTO FLOAT8_TBL(f1) VALUES ('    0.0   ');
+INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30  ');
+INSERT INTO FLOAT8_TBL(f1) VALUES ('   -34.84');
 INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e+200');
 INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
+-- test for underflow and overflow handling
+SELECT '10e400'::float8;
+ERROR:  "10e400" is out of range for type double precision
+SELECT '-10e400'::float8;
+ERROR:  "-10e400" is out of range for type double precision
+SELECT '10e-400'::float8;
+ERROR:  "10e-400" is out of range for type double precision
+SELECT '-10e-400'::float8;
+ERROR:  "-10e-400" is out of range for type double precision
+-- bad input
+INSERT INTO FLOAT8_TBL(f1) VALUES ('     ');
+ERROR:  invalid input syntax for type double precision: "     "
+INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
+ERROR:  invalid input syntax for type double precision: "xyz"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
+ERROR:  invalid input syntax for type double precision: "5.0.0"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
+ERROR:  invalid input syntax for type double precision: "5 . 0"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('5.   0');
+ERROR:  invalid input syntax for type double precision: "5.   0"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('    - 3');
+ERROR:  invalid input syntax for type double precision: "    - 3"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('123           5');
+ERROR:  invalid input syntax for type double precision: "123           5"
+-- special inputs
+SELECT 'NaN'::float8;
+ float8
+--------
+    NaN
+(1 row)
+SELECT 'nan'::float8;
+ float8
+--------
+    NaN
+(1 row)
+
+SELECT '   NAN  '::float8;
+ float8
+--------
+    NaN
+(1 row)
+
+SELECT 'infinity'::float8;
+ float8
+----------
+ Infinity
+(1 row)
+
+SELECT '          -INFINiTY   '::float8;
+  float8
+-----------
+ -Infinity
+(1 row)
+
+-- bad special inputs
+SELECT 'N A N'::float8;
+ERROR:  invalid input syntax for type double precision: "N A N"
+SELECT 'NaN x'::float8;
+ERROR:  invalid input syntax for type double precision: "NaN x"
+SELECT ' INFINITY    x'::float8;
+ERROR:  invalid input syntax for type double precision: " INFINITY    x"
+SELECT 'Infinity'::float8 + 100.0;
+ERROR:  type "double precision" value out of range: overflow
+SELECT 'Infinity'::float8 / 'Infinity'::float8;
+ ?column?
+----------
+      NaN
+(1 row)
+
+SELECT 'nan'::float8 / 'nan'::float8;
+ ?column?
+----------
+      NaN
+(1 row)
+
 SELECT '' AS five, FLOAT8_TBL.*;
  five |          f1          
 ------+----------------------
index 618d4decb6d0db3915ffe7248e2b2f7fd1934b62..11eefa230b78208623f3da352a6c089ca8724590 100644 (file)
@@ -2,11 +2,95 @@
 -- FLOAT8
 --
 CREATE TABLE FLOAT8_TBL(f1 float8);
-INSERT INTO FLOAT8_TBL(f1) VALUES ('0.0');
-INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30');
-INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84');
+INSERT INTO FLOAT8_TBL(f1) VALUES ('    0.0   ');
+INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30  ');
+INSERT INTO FLOAT8_TBL(f1) VALUES ('   -34.84');
 INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e+200');
 INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
+-- test for underflow and overflow handling
+SELECT '10e400'::float8;
+ERROR:  "10e400" is out of range for type double precision
+SELECT '-10e400'::float8;
+ERROR:  "-10e400" is out of range for type double precision
+SELECT '10e-400'::float8;
+ float8 
+--------
+     0
+(1 row)
+
+SELECT '-10e-400'::float8;
+ float8 
+--------
+    -0
+(1 row)
+
+-- bad input
+INSERT INTO FLOAT8_TBL(f1) VALUES ('     ');
+ERROR:  invalid input syntax for type double precision: "     "
+INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
+ERROR:  invalid input syntax for type double precision: "xyz"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
+ERROR:  invalid input syntax for type double precision: "5.0.0"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
+ERROR:  invalid input syntax for type double precision: "5 . 0"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('5.   0');
+ERROR:  invalid input syntax for type double precision: "5.   0"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('    - 3');
+ERROR:  invalid input syntax for type double precision: "    - 3"
+INSERT INTO FLOAT8_TBL(f1) VALUES ('123           5');
+ERROR:  invalid input syntax for type double precision: "123           5"
+-- special inputs
+SELECT 'NaN'::float8;
+ float8 
+--------
+    NaN
+(1 row)
+
+SELECT 'nan'::float8;
+ float8 
+--------
+    NaN
+(1 row)
+
+SELECT '   NAN  '::float8;
+ float8 
+--------
+    NaN
+(1 row)
+
+SELECT 'infinity'::float8;
+  float8  
+----------
+ Infinity
+(1 row)
+
+SELECT '          -INFINiTY   '::float8;
+  float8   
+-----------
+ -Infinity
+(1 row)
+
+-- bad special inputs
+SELECT 'N A N'::float8;
+ERROR:  invalid input syntax for type double precision: "N A N"
+SELECT 'NaN x'::float8;
+ERROR:  invalid input syntax for type double precision: "NaN x"
+SELECT ' INFINITY    x'::float8;
+ERROR:  invalid input syntax for type double precision: " INFINITY    x"
+SELECT 'Infinity'::float8 + 100.0;
+ERROR:  type "double precision" value out of range: overflow
+SELECT 'Infinity'::float8 / 'Infinity'::float8;
+ ?column? 
+----------
+      NaN
+(1 row)
+
+SELECT 'nan'::float8 / 'nan'::float8;
+ ?column? 
+----------
+      NaN
+(1 row)
+
 SELECT '' AS five, FLOAT8_TBL.*;
  five |          f1          
 ------+----------------------
index 798a67c04fe4fc4ef2909aecd1799d3c9346931b..03a493aaa4ee1738444ee09bc00f36bdd052fb07 100644 (file)
@@ -7,14 +7,14 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30  ');
 INSERT INTO FLOAT8_TBL(f1) VALUES ('   -34.84');
 INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e+200');
 INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
--- test for underflow and overflow
-INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
+-- test for underflow and overflow handling
+SELECT '10e400'::float8;
 ERROR:  "10e400" is out of range for type double precision
-INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
+SELECT '-10e400'::float8;
 ERROR:  "-10e400" is out of range for type double precision
-INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
+SELECT '10e-400'::float8;
 ERROR:  "10e-400" is out of range for type double precision
-INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
+SELECT '-10e-400'::float8;
 ERROR:  "-10e-400" is out of range for type double precision
 -- bad input
 INSERT INTO FLOAT8_TBL(f1) VALUES ('     ');
index 593df68a326d9e3ba35486d2eac983d3b3fab837..4c706099cdddd9aae6a2dabe20190f83fc6ac8e0 100644 (file)
@@ -10,11 +10,11 @@ INSERT INTO FLOAT8_TBL(f1) VALUES ('   -34.84');
 INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e+200');
 INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
 
--- test for underflow and overflow
-INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
-INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
-INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
-INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
+-- test for underflow and overflow handling
+SELECT '10e400'::float8;
+SELECT '-10e400'::float8;
+SELECT '10e-400'::float8;
+SELECT '-10e-400'::float8;
 
 -- bad input
 INSERT INTO FLOAT8_TBL(f1) VALUES ('     ');