1--
2-- FLOAT8
3--
4CREATE TABLE FLOAT8_TBL(f1 float8);
5INSERT INTO FLOAT8_TBL(f1) VALUES ('    0.0   ');
6INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30  ');
7INSERT INTO FLOAT8_TBL(f1) VALUES ('   -34.84');
8INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e+200');
9INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200');
10-- test for underflow and overflow handling
11SELECT '10e400'::float8;
12ERROR:  "10e400" is out of range for type double precision
13LINE 1: SELECT '10e400'::float8;
14               ^
15SELECT '-10e400'::float8;
16ERROR:  "-10e400" is out of range for type double precision
17LINE 1: SELECT '-10e400'::float8;
18               ^
19SELECT '10e-400'::float8;
20ERROR:  "10e-400" is out of range for type double precision
21LINE 1: SELECT '10e-400'::float8;
22               ^
23SELECT '-10e-400'::float8;
24ERROR:  "-10e-400" is out of range for type double precision
25LINE 1: SELECT '-10e-400'::float8;
26               ^
27-- test smallest normalized input
28SELECT float8send('2.2250738585072014E-308'::float8);
29     float8send
30--------------------
31 \x0010000000000000
32(1 row)
33
34-- bad input
35INSERT INTO FLOAT8_TBL(f1) VALUES ('');
36ERROR:  invalid input syntax for type double precision: ""
37LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('');
38                                           ^
39INSERT INTO FLOAT8_TBL(f1) VALUES ('     ');
40ERROR:  invalid input syntax for type double precision: "     "
41LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('     ');
42                                           ^
43INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
44ERROR:  invalid input syntax for type double precision: "xyz"
45LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz');
46                                           ^
47INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
48ERROR:  invalid input syntax for type double precision: "5.0.0"
49LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0');
50                                           ^
51INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
52ERROR:  invalid input syntax for type double precision: "5 . 0"
53LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0');
54                                           ^
55INSERT INTO FLOAT8_TBL(f1) VALUES ('5.   0');
56ERROR:  invalid input syntax for type double precision: "5.   0"
57LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('5.   0');
58                                           ^
59INSERT INTO FLOAT8_TBL(f1) VALUES ('    - 3');
60ERROR:  invalid input syntax for type double precision: "    - 3"
61LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('    - 3');
62                                           ^
63INSERT INTO FLOAT8_TBL(f1) VALUES ('123           5');
64ERROR:  invalid input syntax for type double precision: "123           5"
65LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('123           5');
66                                           ^
67-- special inputs
68SELECT 'NaN'::float8;
69 float8
70--------
71    NaN
72(1 row)
73
74SELECT 'nan'::float8;
75 float8
76--------
77    NaN
78(1 row)
79
80SELECT '   NAN  '::float8;
81 float8
82--------
83    NaN
84(1 row)
85
86SELECT 'infinity'::float8;
87  float8
88----------
89 Infinity
90(1 row)
91
92SELECT '          -INFINiTY   '::float8;
93  float8
94-----------
95 -Infinity
96(1 row)
97
98-- bad special inputs
99SELECT 'N A N'::float8;
100ERROR:  invalid input syntax for type double precision: "N A N"
101LINE 1: SELECT 'N A N'::float8;
102               ^
103SELECT 'NaN x'::float8;
104ERROR:  invalid input syntax for type double precision: "NaN x"
105LINE 1: SELECT 'NaN x'::float8;
106               ^
107SELECT ' INFINITY    x'::float8;
108ERROR:  invalid input syntax for type double precision: " INFINITY    x"
109LINE 1: SELECT ' INFINITY    x'::float8;
110               ^
111SELECT 'Infinity'::float8 + 100.0;
112 ?column?
113----------
114 Infinity
115(1 row)
116
117SELECT 'Infinity'::float8 / 'Infinity'::float8;
118 ?column?
119----------
120      NaN
121(1 row)
122
123SELECT '42'::float8 / 'Infinity'::float8;
124 ?column?
125----------
126        0
127(1 row)
128
129SELECT 'nan'::float8 / 'nan'::float8;
130 ?column?
131----------
132      NaN
133(1 row)
134
135SELECT 'nan'::float8 / '0'::float8;
136 ?column?
137----------
138      NaN
139(1 row)
140
141SELECT 'nan'::numeric::float8;
142 float8
143--------
144    NaN
145(1 row)
146
147SELECT * FROM FLOAT8_TBL;
148          f1
149----------------------
150                    0
151               1004.3
152               -34.84
153 1.2345678901234e+200
154 1.2345678901234e-200
155(5 rows)
156
157SELECT f.* FROM FLOAT8_TBL f WHERE f.f1 <> '1004.3';
158          f1
159----------------------
160                    0
161               -34.84
162 1.2345678901234e+200
163 1.2345678901234e-200
164(4 rows)
165
166SELECT f.* FROM FLOAT8_TBL f WHERE f.f1 = '1004.3';
167   f1
168--------
169 1004.3
170(1 row)
171
172SELECT f.* FROM FLOAT8_TBL f WHERE '1004.3' > f.f1;
173          f1
174----------------------
175                    0
176               -34.84
177 1.2345678901234e-200
178(3 rows)
179
180SELECT f.* FROM FLOAT8_TBL f WHERE  f.f1 < '1004.3';
181          f1
182----------------------
183                    0
184               -34.84
185 1.2345678901234e-200
186(3 rows)
187
188SELECT f.* FROM FLOAT8_TBL f WHERE '1004.3' >= f.f1;
189          f1
190----------------------
191                    0
192               1004.3
193               -34.84
194 1.2345678901234e-200
195(4 rows)
196
197SELECT f.* FROM FLOAT8_TBL f WHERE  f.f1 <= '1004.3';
198          f1
199----------------------
200                    0
201               1004.3
202               -34.84
203 1.2345678901234e-200
204(4 rows)
205
206SELECT f.f1, f.f1 * '-10' AS x
207   FROM FLOAT8_TBL f
208   WHERE f.f1 > '0.0';
209          f1          |           x
210----------------------+-----------------------
211               1004.3 |                -10043
212 1.2345678901234e+200 | -1.2345678901234e+201
213 1.2345678901234e-200 | -1.2345678901234e-199
214(3 rows)
215
216SELECT f.f1, f.f1 + '-10' AS x
217   FROM FLOAT8_TBL f
218   WHERE f.f1 > '0.0';
219          f1          |          x
220----------------------+----------------------
221               1004.3 |                994.3
222 1.2345678901234e+200 | 1.2345678901234e+200
223 1.2345678901234e-200 |                  -10
224(3 rows)
225
226SELECT f.f1, f.f1 / '-10' AS x
227   FROM FLOAT8_TBL f
228   WHERE f.f1 > '0.0';
229          f1          |           x
230----------------------+-----------------------
231               1004.3 |   -100.42999999999999
232 1.2345678901234e+200 | -1.2345678901234e+199
233 1.2345678901234e-200 | -1.2345678901234e-201
234(3 rows)
235
236SELECT f.f1, f.f1 - '-10' AS x
237   FROM FLOAT8_TBL f
238   WHERE f.f1 > '0.0';
239          f1          |          x
240----------------------+----------------------
241               1004.3 |               1014.3
242 1.2345678901234e+200 | 1.2345678901234e+200
243 1.2345678901234e-200 |                   10
244(3 rows)
245
246SELECT f.f1 ^ '2.0' AS square_f1
247   FROM FLOAT8_TBL f where f.f1 = '1004.3';
248     square_f1
249--------------------
250 1008618.4899999999
251(1 row)
252
253-- absolute value
254SELECT f.f1, @f.f1 AS abs_f1
255   FROM FLOAT8_TBL f;
256          f1          |        abs_f1
257----------------------+----------------------
258                    0 |                    0
259               1004.3 |               1004.3
260               -34.84 |                34.84
261 1.2345678901234e+200 | 1.2345678901234e+200
262 1.2345678901234e-200 | 1.2345678901234e-200
263(5 rows)
264
265-- truncate
266SELECT f.f1, trunc(f.f1) AS trunc_f1
267   FROM FLOAT8_TBL f;
268          f1          |       trunc_f1
269----------------------+----------------------
270                    0 |                    0
271               1004.3 |                 1004
272               -34.84 |                  -34
273 1.2345678901234e+200 | 1.2345678901234e+200
274 1.2345678901234e-200 |                    0
275(5 rows)
276
277-- round
278SELECT f.f1, round(f.f1) AS round_f1
279   FROM FLOAT8_TBL f;
280          f1          |       round_f1
281----------------------+----------------------
282                    0 |                    0
283               1004.3 |                 1004
284               -34.84 |                  -35
285 1.2345678901234e+200 | 1.2345678901234e+200
286 1.2345678901234e-200 |                    0
287(5 rows)
288
289-- ceil / ceiling
290select ceil(f1) as ceil_f1 from float8_tbl f;
291       ceil_f1
292----------------------
293                    0
294                 1005
295                  -34
296 1.2345678901234e+200
297                    1
298(5 rows)
299
300select ceiling(f1) as ceiling_f1 from float8_tbl f;
301      ceiling_f1
302----------------------
303                    0
304                 1005
305                  -34
306 1.2345678901234e+200
307                    1
308(5 rows)
309
310-- floor
311select floor(f1) as floor_f1 from float8_tbl f;
312       floor_f1
313----------------------
314                    0
315                 1004
316                  -35
317 1.2345678901234e+200
318                    0
319(5 rows)
320
321-- sign
322select sign(f1) as sign_f1 from float8_tbl f;
323 sign_f1
324---------
325       0
326       1
327      -1
328       1
329       1
330(5 rows)
331
332-- avoid bit-exact output here because operations may not be bit-exact.
333SET extra_float_digits = 0;
334-- square root
335SELECT sqrt(float8 '64') AS eight;
336 eight
337-------
338     8
339(1 row)
340
341SELECT |/ float8 '64' AS eight;
342 eight
343-------
344     8
345(1 row)
346
347SELECT f.f1, |/f.f1 AS sqrt_f1
348   FROM FLOAT8_TBL f
349   WHERE f.f1 > '0.0';
350          f1          |        sqrt_f1
351----------------------+-----------------------
352               1004.3 |      31.6906926399535
353 1.2345678901234e+200 | 1.11111110611109e+100
354 1.2345678901234e-200 | 1.11111110611109e-100
355(3 rows)
356
357-- power
358SELECT power(float8 '144', float8 '0.5');
359 power
360-------
361    12
362(1 row)
363
364SELECT power(float8 'NaN', float8 '0.5');
365 power
366-------
367   NaN
368(1 row)
369
370SELECT power(float8 '144', float8 'NaN');
371 power
372-------
373   NaN
374(1 row)
375
376SELECT power(float8 'NaN', float8 'NaN');
377 power
378-------
379   NaN
380(1 row)
381
382SELECT power(float8 '-1', float8 'NaN');
383 power
384-------
385   NaN
386(1 row)
387
388SELECT power(float8 '1', float8 'NaN');
389 power
390-------
391     1
392(1 row)
393
394SELECT power(float8 'NaN', float8 '0');
395 power
396-------
397     1
398(1 row)
399
400SELECT power(float8 'inf', float8 '0');
401 power
402-------
403     1
404(1 row)
405
406SELECT power(float8 '-inf', float8 '0');
407 power
408-------
409     1
410(1 row)
411
412SELECT power(float8 '0', float8 'inf');
413 power
414-------
415     0
416(1 row)
417
418SELECT power(float8 '0', float8 '-inf');
419ERROR:  zero raised to a negative power is undefined
420SELECT power(float8 '1', float8 'inf');
421 power
422-------
423     1
424(1 row)
425
426SELECT power(float8 '1', float8 '-inf');
427 power
428-------
429     1
430(1 row)
431
432SELECT power(float8 '-1', float8 'inf');
433 power
434-------
435     1
436(1 row)
437
438SELECT power(float8 '-1', float8 '-inf');
439 power
440-------
441     1
442(1 row)
443
444SELECT power(float8 '0.1', float8 'inf');
445 power
446-------
447     0
448(1 row)
449
450SELECT power(float8 '-0.1', float8 'inf');
451 power
452-------
453     0
454(1 row)
455
456SELECT power(float8 '1.1', float8 'inf');
457  power
458----------
459 Infinity
460(1 row)
461
462SELECT power(float8 '-1.1', float8 'inf');
463  power
464----------
465 Infinity
466(1 row)
467
468SELECT power(float8 '0.1', float8 '-inf');
469  power
470----------
471 Infinity
472(1 row)
473
474SELECT power(float8 '-0.1', float8 '-inf');
475  power
476----------
477 Infinity
478(1 row)
479
480SELECT power(float8 '1.1', float8 '-inf');
481 power
482-------
483     0
484(1 row)
485
486SELECT power(float8 '-1.1', float8 '-inf');
487 power
488-------
489     0
490(1 row)
491
492SELECT power(float8 'inf', float8 '-2');
493 power
494-------
495     0
496(1 row)
497
498SELECT power(float8 'inf', float8 '2');
499  power
500----------
501 Infinity
502(1 row)
503
504SELECT power(float8 'inf', float8 'inf');
505  power
506----------
507 Infinity
508(1 row)
509
510SELECT power(float8 'inf', float8 '-inf');
511 power
512-------
513     0
514(1 row)
515
516-- Intel's icc misoptimizes the code that controls the sign of this result,
517-- even with -mp1.  Pending a fix for that, only test for "is it zero".
518SELECT power(float8 '-inf', float8 '-2') = '0';
519 ?column?
520----------
521 t
522(1 row)
523
524SELECT power(float8 '-inf', float8 '-3');
525 power
526-------
527    -0
528(1 row)
529
530SELECT power(float8 '-inf', float8 '2');
531  power
532----------
533 Infinity
534(1 row)
535
536SELECT power(float8 '-inf', float8 '3');
537   power
538-----------
539 -Infinity
540(1 row)
541
542SELECT power(float8 '-inf', float8 '3.5');
543ERROR:  a negative number raised to a non-integer power yields a complex result
544SELECT power(float8 '-inf', float8 'inf');
545  power
546----------
547 Infinity
548(1 row)
549
550SELECT power(float8 '-inf', float8 '-inf');
551 power
552-------
553     0
554(1 row)
555
556-- take exp of ln(f.f1)
557SELECT f.f1, exp(ln(f.f1)) AS exp_ln_f1
558   FROM FLOAT8_TBL f
559   WHERE f.f1 > '0.0';
560          f1          |       exp_ln_f1
561----------------------+-----------------------
562               1004.3 |                1004.3
563 1.2345678901234e+200 | 1.23456789012338e+200
564 1.2345678901234e-200 | 1.23456789012339e-200
565(3 rows)
566
567-- check edge cases for exp
568SELECT exp('inf'::float8), exp('-inf'::float8), exp('nan'::float8);
569   exp    | exp | exp
570----------+-----+-----
571 Infinity |   0 | NaN
572(1 row)
573
574-- cube root
575SELECT ||/ float8 '27' AS three;
576 three
577-------
578     3
579(1 row)
580
581SELECT f.f1, ||/f.f1 AS cbrt_f1 FROM FLOAT8_TBL f;
582          f1          |       cbrt_f1
583----------------------+----------------------
584                    0 |                    0
585               1004.3 |      10.014312837827
586               -34.84 |    -3.26607421344208
587 1.2345678901234e+200 | 4.97933859234765e+66
588 1.2345678901234e-200 |  2.3112042409018e-67
589(5 rows)
590
591SELECT * FROM FLOAT8_TBL;
592          f1
593----------------------
594                    0
595               1004.3
596               -34.84
597 1.2345678901234e+200
598 1.2345678901234e-200
599(5 rows)
600
601UPDATE FLOAT8_TBL
602   SET f1 = FLOAT8_TBL.f1 * '-1'
603   WHERE FLOAT8_TBL.f1 > '0.0';
604SELECT f.f1 * '1e200' from FLOAT8_TBL f;
605ERROR:  value out of range: overflow
606SELECT f.f1 ^ '1e200' from FLOAT8_TBL f;
607ERROR:  value out of range: overflow
608SELECT 0 ^ 0 + 0 ^ 1 + 0 ^ 0.0 + 0 ^ 0.5;
609 ?column?
610----------
611        2
612(1 row)
613
614SELECT ln(f.f1) from FLOAT8_TBL f where f.f1 = '0.0' ;
615ERROR:  cannot take logarithm of zero
616SELECT ln(f.f1) from FLOAT8_TBL f where f.f1 < '0.0' ;
617ERROR:  cannot take logarithm of a negative number
618SELECT exp(f.f1) from FLOAT8_TBL f;
619ERROR:  value out of range: underflow
620SELECT f.f1 / '0.0' from FLOAT8_TBL f;
621ERROR:  division by zero
622SELECT * FROM FLOAT8_TBL;
623          f1
624-----------------------
625                     0
626                -34.84
627               -1004.3
628 -1.2345678901234e+200
629 -1.2345678901234e-200
630(5 rows)
631
632-- hyperbolic functions
633-- we run these with extra_float_digits = 0 too, since different platforms
634-- tend to produce results that vary in the last place.
635SELECT sinh(float8 '1');
636      sinh
637-----------------
638 1.1752011936438
639(1 row)
640
641SELECT cosh(float8 '1');
642       cosh
643------------------
644 1.54308063481524
645(1 row)
646
647SELECT tanh(float8 '1');
648       tanh
649-------------------
650 0.761594155955765
651(1 row)
652
653SELECT asinh(float8 '1');
654       asinh
655-------------------
656 0.881373587019543
657(1 row)
658
659SELECT acosh(float8 '2');
660      acosh
661------------------
662 1.31695789692482
663(1 row)
664
665SELECT atanh(float8 '0.5');
666       atanh
667-------------------
668 0.549306144334055
669(1 row)
670
671-- test Inf/NaN cases for hyperbolic functions
672SELECT sinh(float8 'infinity');
673   sinh
674----------
675 Infinity
676(1 row)
677
678SELECT sinh(float8 '-infinity');
679   sinh
680-----------
681 -Infinity
682(1 row)
683
684SELECT sinh(float8 'nan');
685 sinh
686------
687  NaN
688(1 row)
689
690SELECT cosh(float8 'infinity');
691   cosh
692----------
693 Infinity
694(1 row)
695
696SELECT cosh(float8 '-infinity');
697   cosh
698----------
699 Infinity
700(1 row)
701
702SELECT cosh(float8 'nan');
703 cosh
704------
705  NaN
706(1 row)
707
708SELECT tanh(float8 'infinity');
709 tanh
710------
711    1
712(1 row)
713
714SELECT tanh(float8 '-infinity');
715 tanh
716------
717   -1
718(1 row)
719
720SELECT tanh(float8 'nan');
721 tanh
722------
723  NaN
724(1 row)
725
726SELECT asinh(float8 'infinity');
727  asinh
728----------
729 Infinity
730(1 row)
731
732SELECT asinh(float8 '-infinity');
733   asinh
734-----------
735 -Infinity
736(1 row)
737
738SELECT asinh(float8 'nan');
739 asinh
740-------
741   NaN
742(1 row)
743
744-- acosh(Inf) should be Inf, but some mingw versions produce NaN, so skip test
745-- SELECT acosh(float8 'infinity');
746SELECT acosh(float8 '-infinity');
747ERROR:  input is out of range
748SELECT acosh(float8 'nan');
749 acosh
750-------
751   NaN
752(1 row)
753
754SELECT atanh(float8 'infinity');
755ERROR:  input is out of range
756SELECT atanh(float8 '-infinity');
757ERROR:  input is out of range
758SELECT atanh(float8 'nan');
759 atanh
760-------
761   NaN
762(1 row)
763
764RESET extra_float_digits;
765-- test for over- and underflow
766INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
767ERROR:  "10e400" is out of range for type double precision
768LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
769                                           ^
770INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
771ERROR:  "-10e400" is out of range for type double precision
772LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
773                                           ^
774INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
775ERROR:  "10e-400" is out of range for type double precision
776LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
777                                           ^
778INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
779ERROR:  "-10e-400" is out of range for type double precision
780LINE 1: INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
781                                           ^
782-- maintain external table consistency across platforms
783-- delete all values and reinsert well-behaved ones
784DELETE FROM FLOAT8_TBL;
785INSERT INTO FLOAT8_TBL(f1) VALUES ('0.0');
786INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84');
787INSERT INTO FLOAT8_TBL(f1) VALUES ('-1004.30');
788INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e+200');
789INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e-200');
790SELECT * FROM FLOAT8_TBL;
791          f1
792-----------------------
793                     0
794                -34.84
795               -1004.3
796 -1.2345678901234e+200
797 -1.2345678901234e-200
798(5 rows)
799
800-- test edge-case coercions to integer
801SELECT '32767.4'::float8::int2;
802 int2
803-------
804 32767
805(1 row)
806
807SELECT '32767.6'::float8::int2;
808ERROR:  smallint out of range
809SELECT '-32768.4'::float8::int2;
810  int2
811--------
812 -32768
813(1 row)
814
815SELECT '-32768.6'::float8::int2;
816ERROR:  smallint out of range
817SELECT '2147483647.4'::float8::int4;
818    int4
819------------
820 2147483647
821(1 row)
822
823SELECT '2147483647.6'::float8::int4;
824ERROR:  integer out of range
825SELECT '-2147483648.4'::float8::int4;
826    int4
827-------------
828 -2147483648
829(1 row)
830
831SELECT '-2147483648.6'::float8::int4;
832ERROR:  integer out of range
833SELECT '9223372036854773760'::float8::int8;
834        int8
835---------------------
836 9223372036854773760
837(1 row)
838
839SELECT '9223372036854775807'::float8::int8;
840ERROR:  bigint out of range
841SELECT '-9223372036854775808.5'::float8::int8;
842         int8
843----------------------
844 -9223372036854775808
845(1 row)
846
847SELECT '-9223372036854780000'::float8::int8;
848ERROR:  bigint out of range
849-- test exact cases for trigonometric functions in degrees
850SELECT x,
851       sind(x),
852       sind(x) IN (-1,-0.5,0,0.5,1) AS sind_exact
853FROM (VALUES (0), (30), (90), (150), (180),
854      (210), (270), (330), (360)) AS t(x);
855  x  | sind | sind_exact
856-----+------+------------
857   0 |    0 | t
858  30 |  0.5 | t
859  90 |    1 | t
860 150 |  0.5 | t
861 180 |    0 | t
862 210 | -0.5 | t
863 270 |   -1 | t
864 330 | -0.5 | t
865 360 |    0 | t
866(9 rows)
867
868SELECT x,
869       cosd(x),
870       cosd(x) IN (-1,-0.5,0,0.5,1) AS cosd_exact
871FROM (VALUES (0), (60), (90), (120), (180),
872      (240), (270), (300), (360)) AS t(x);
873  x  | cosd | cosd_exact
874-----+------+------------
875   0 |    1 | t
876  60 |  0.5 | t
877  90 |    0 | t
878 120 | -0.5 | t
879 180 |   -1 | t
880 240 | -0.5 | t
881 270 |    0 | t
882 300 |  0.5 | t
883 360 |    1 | t
884(9 rows)
885
886SELECT x,
887       tand(x),
888       tand(x) IN ('-Infinity'::float8,-1,0,
889                   1,'Infinity'::float8) AS tand_exact,
890       cotd(x),
891       cotd(x) IN ('-Infinity'::float8,-1,0,
892                   1,'Infinity'::float8) AS cotd_exact
893FROM (VALUES (0), (45), (90), (135), (180),
894      (225), (270), (315), (360)) AS t(x);
895  x  |   tand    | tand_exact |   cotd    | cotd_exact
896-----+-----------+------------+-----------+------------
897   0 |         0 | t          |  Infinity | t
898  45 |         1 | t          |         1 | t
899  90 |  Infinity | t          |         0 | t
900 135 |        -1 | t          |        -1 | t
901 180 |         0 | t          | -Infinity | t
902 225 |         1 | t          |         1 | t
903 270 | -Infinity | t          |         0 | t
904 315 |        -1 | t          |        -1 | t
905 360 |         0 | t          |  Infinity | t
906(9 rows)
907
908SELECT x,
909       asind(x),
910       asind(x) IN (-90,-30,0,30,90) AS asind_exact,
911       acosd(x),
912       acosd(x) IN (0,60,90,120,180) AS acosd_exact
913FROM (VALUES (-1), (-0.5), (0), (0.5), (1)) AS t(x);
914  x   | asind | asind_exact | acosd | acosd_exact
915------+-------+-------------+-------+-------------
916   -1 |   -90 | t           |   180 | t
917 -0.5 |   -30 | t           |   120 | t
918    0 |     0 | t           |    90 | t
919  0.5 |    30 | t           |    60 | t
920    1 |    90 | t           |     0 | t
921(5 rows)
922
923SELECT x,
924       atand(x),
925       atand(x) IN (-90,-45,0,45,90) AS atand_exact
926FROM (VALUES ('-Infinity'::float8), (-1), (0), (1),
927      ('Infinity'::float8)) AS t(x);
928     x     | atand | atand_exact
929-----------+-------+-------------
930 -Infinity |   -90 | t
931        -1 |   -45 | t
932         0 |     0 | t
933         1 |    45 | t
934  Infinity |    90 | t
935(5 rows)
936
937SELECT x, y,
938       atan2d(y, x),
939       atan2d(y, x) IN (-90,0,90,180) AS atan2d_exact
940FROM (SELECT 10*cosd(a), 10*sind(a)
941      FROM generate_series(0, 360, 90) AS t(a)) AS t(x,y);
942  x  |  y  | atan2d | atan2d_exact
943-----+-----+--------+--------------
944  10 |   0 |      0 | t
945   0 |  10 |     90 | t
946 -10 |   0 |    180 | t
947   0 | -10 |    -90 | t
948  10 |   0 |      0 | t
949(5 rows)
950
951--
952-- test output (and round-trip safety) of various values.
953-- To ensure we're testing what we think we're testing, start with
954-- float values specified by bit patterns (as a useful side effect,
955-- this means we'll fail on non-IEEE platforms).
956create type xfloat8;
957create function xfloat8in(cstring) returns xfloat8 immutable strict
958  language internal as 'int8in';
959NOTICE:  return type xfloat8 is only a shell
960create function xfloat8out(xfloat8) returns cstring immutable strict
961  language internal as 'int8out';
962NOTICE:  argument type xfloat8 is only a shell
963create type xfloat8 (input = xfloat8in, output = xfloat8out, like = float8);
964create cast (xfloat8 as float8) without function;
965create cast (float8 as xfloat8) without function;
966create cast (xfloat8 as bigint) without function;
967create cast (bigint as xfloat8) without function;
968-- float8: seeeeeee eeeeeeee eeeeeeee mmmmmmmm mmmmmmmm(x4)
969-- we don't care to assume the platform's strtod() handles subnormals
970-- correctly; those are "use at your own risk". However we do test
971-- subnormal outputs, since those are under our control.
972with testdata(bits) as (values
973  -- small subnormals
974  (x'0000000000000001'),
975  (x'0000000000000002'), (x'0000000000000003'),
976  (x'0000000000001000'), (x'0000000100000000'),
977  (x'0000010000000000'), (x'0000010100000000'),
978  (x'0000400000000000'), (x'0000400100000000'),
979  (x'0000800000000000'), (x'0000800000000001'),
980  -- these values taken from upstream testsuite
981  (x'00000000000f4240'),
982  (x'00000000016e3600'),
983  (x'0000008cdcdea440'),
984  -- borderline between subnormal and normal
985  (x'000ffffffffffff0'), (x'000ffffffffffff1'),
986  (x'000ffffffffffffe'), (x'000fffffffffffff'))
987select float8send(flt) as ibits,
988       flt
989  from (select bits::bigint::xfloat8::float8 as flt
990          from testdata
991	offset 0) s;
992       ibits        |           flt
993--------------------+-------------------------
994 \x0000000000000001 |                  5e-324
995 \x0000000000000002 |                  1e-323
996 \x0000000000000003 |                1.5e-323
997 \x0000000000001000 |             2.0237e-320
998 \x0000000100000000 |        2.121995791e-314
999 \x0000010000000000 |      5.43230922487e-312
1000 \x0000010100000000 |      5.45352918278e-312
1001 \x0000400000000000 |    3.4766779039175e-310
1002 \x0000400100000000 |    3.4768901034966e-310
1003 \x0000800000000000 |     6.953355807835e-310
1004 \x0000800000000001 |   6.95335580783505e-310
1005 \x00000000000f4240 |           4.940656e-318
1006 \x00000000016e3600 |         1.18575755e-316
1007 \x0000008cdcdea440 |     2.989102097996e-312
1008 \x000ffffffffffff0 | 2.2250738585071935e-308
1009 \x000ffffffffffff1 |  2.225073858507194e-308
1010 \x000ffffffffffffe | 2.2250738585072004e-308
1011 \x000fffffffffffff |  2.225073858507201e-308
1012(18 rows)
1013
1014-- round-trip tests
1015with testdata(bits) as (values
1016  (x'0000000000000000'),
1017  -- smallest normal values
1018  (x'0010000000000000'), (x'0010000000000001'),
1019  (x'0010000000000002'), (x'0018000000000000'),
1020  --
1021  (x'3ddb7cdfd9d7bdba'), (x'3ddb7cdfd9d7bdbb'), (x'3ddb7cdfd9d7bdbc'),
1022  (x'3e112e0be826d694'), (x'3e112e0be826d695'), (x'3e112e0be826d696'),
1023  (x'3e45798ee2308c39'), (x'3e45798ee2308c3a'), (x'3e45798ee2308c3b'),
1024  (x'3e7ad7f29abcaf47'), (x'3e7ad7f29abcaf48'), (x'3e7ad7f29abcaf49'),
1025  (x'3eb0c6f7a0b5ed8c'), (x'3eb0c6f7a0b5ed8d'), (x'3eb0c6f7a0b5ed8e'),
1026  (x'3ee4f8b588e368ef'), (x'3ee4f8b588e368f0'), (x'3ee4f8b588e368f1'),
1027  (x'3f1a36e2eb1c432c'), (x'3f1a36e2eb1c432d'), (x'3f1a36e2eb1c432e'),
1028  (x'3f50624dd2f1a9fb'), (x'3f50624dd2f1a9fc'), (x'3f50624dd2f1a9fd'),
1029  (x'3f847ae147ae147a'), (x'3f847ae147ae147b'), (x'3f847ae147ae147c'),
1030  (x'3fb9999999999999'), (x'3fb999999999999a'), (x'3fb999999999999b'),
1031  -- values very close to 1
1032  (x'3feffffffffffff0'), (x'3feffffffffffff1'), (x'3feffffffffffff2'),
1033  (x'3feffffffffffff3'), (x'3feffffffffffff4'), (x'3feffffffffffff5'),
1034  (x'3feffffffffffff6'), (x'3feffffffffffff7'), (x'3feffffffffffff8'),
1035  (x'3feffffffffffff9'), (x'3feffffffffffffa'), (x'3feffffffffffffb'),
1036  (x'3feffffffffffffc'), (x'3feffffffffffffd'), (x'3feffffffffffffe'),
1037  (x'3fefffffffffffff'),
1038  (x'3ff0000000000000'),
1039  (x'3ff0000000000001'), (x'3ff0000000000002'), (x'3ff0000000000003'),
1040  (x'3ff0000000000004'), (x'3ff0000000000005'), (x'3ff0000000000006'),
1041  (x'3ff0000000000007'), (x'3ff0000000000008'), (x'3ff0000000000009'),
1042  --
1043  (x'3ff921fb54442d18'),
1044  (x'4005bf0a8b14576a'),
1045  (x'400921fb54442d18'),
1046  --
1047  (x'4023ffffffffffff'), (x'4024000000000000'), (x'4024000000000001'),
1048  (x'4058ffffffffffff'), (x'4059000000000000'), (x'4059000000000001'),
1049  (x'408f3fffffffffff'), (x'408f400000000000'), (x'408f400000000001'),
1050  (x'40c387ffffffffff'), (x'40c3880000000000'), (x'40c3880000000001'),
1051  (x'40f869ffffffffff'), (x'40f86a0000000000'), (x'40f86a0000000001'),
1052  (x'412e847fffffffff'), (x'412e848000000000'), (x'412e848000000001'),
1053  (x'416312cfffffffff'), (x'416312d000000000'), (x'416312d000000001'),
1054  (x'4197d783ffffffff'), (x'4197d78400000000'), (x'4197d78400000001'),
1055  (x'41cdcd64ffffffff'), (x'41cdcd6500000000'), (x'41cdcd6500000001'),
1056  (x'4202a05f1fffffff'), (x'4202a05f20000000'), (x'4202a05f20000001'),
1057  (x'42374876e7ffffff'), (x'42374876e8000000'), (x'42374876e8000001'),
1058  (x'426d1a94a1ffffff'), (x'426d1a94a2000000'), (x'426d1a94a2000001'),
1059  (x'42a2309ce53fffff'), (x'42a2309ce5400000'), (x'42a2309ce5400001'),
1060  (x'42d6bcc41e8fffff'), (x'42d6bcc41e900000'), (x'42d6bcc41e900001'),
1061  (x'430c6bf52633ffff'), (x'430c6bf526340000'), (x'430c6bf526340001'),
1062  (x'4341c37937e07fff'), (x'4341c37937e08000'), (x'4341c37937e08001'),
1063  (x'4376345785d89fff'), (x'4376345785d8a000'), (x'4376345785d8a001'),
1064  (x'43abc16d674ec7ff'), (x'43abc16d674ec800'), (x'43abc16d674ec801'),
1065  (x'43e158e460913cff'), (x'43e158e460913d00'), (x'43e158e460913d01'),
1066  (x'4415af1d78b58c3f'), (x'4415af1d78b58c40'), (x'4415af1d78b58c41'),
1067  (x'444b1ae4d6e2ef4f'), (x'444b1ae4d6e2ef50'), (x'444b1ae4d6e2ef51'),
1068  (x'4480f0cf064dd591'), (x'4480f0cf064dd592'), (x'4480f0cf064dd593'),
1069  (x'44b52d02c7e14af5'), (x'44b52d02c7e14af6'), (x'44b52d02c7e14af7'),
1070  (x'44ea784379d99db3'), (x'44ea784379d99db4'), (x'44ea784379d99db5'),
1071  (x'45208b2a2c280290'), (x'45208b2a2c280291'), (x'45208b2a2c280292'),
1072  --
1073  (x'7feffffffffffffe'), (x'7fefffffffffffff'),
1074  -- round to even tests (+ve)
1075  (x'4350000000000002'),
1076  (x'4350000000002e06'),
1077  (x'4352000000000003'),
1078  (x'4352000000000004'),
1079  (x'4358000000000003'),
1080  (x'4358000000000004'),
1081  (x'435f000000000020'),
1082  -- round to even tests (-ve)
1083  (x'c350000000000002'),
1084  (x'c350000000002e06'),
1085  (x'c352000000000003'),
1086  (x'c352000000000004'),
1087  (x'c358000000000003'),
1088  (x'c358000000000004'),
1089  (x'c35f000000000020'),
1090  -- exercise fixed-point memmoves
1091  (x'42dc12218377de66'),
1092  (x'42a674e79c5fe51f'),
1093  (x'4271f71fb04cb74c'),
1094  (x'423cbe991a145879'),
1095  (x'4206fee0e1a9e061'),
1096  (x'41d26580b487e6b4'),
1097  (x'419d6f34540ca453'),
1098  (x'41678c29dcd6e9dc'),
1099  (x'4132d687e3df217d'),
1100  (x'40fe240c9fcb68c8'),
1101  (x'40c81cd6e63c53d3'),
1102  (x'40934a4584fd0fdc'),
1103  (x'405edd3c07fb4c93'),
1104  (x'4028b0fcd32f7076'),
1105  (x'3ff3c0ca428c59f8'),
1106  -- these cases come from the upstream's testsuite
1107  -- LotsOfTrailingZeros)
1108  (x'3e60000000000000'),
1109  -- Regression
1110  (x'c352bd2668e077c4'),
1111  (x'434018601510c000'),
1112  (x'43d055dc36f24000'),
1113  (x'43e052961c6f8000'),
1114  (x'3ff3c0ca2a5b1d5d'),
1115  -- LooksLikePow5
1116  (x'4830f0cf064dd592'),
1117  (x'4840f0cf064dd592'),
1118  (x'4850f0cf064dd592'),
1119  -- OutputLength
1120  (x'3ff3333333333333'),
1121  (x'3ff3ae147ae147ae'),
1122  (x'3ff3be76c8b43958'),
1123  (x'3ff3c083126e978d'),
1124  (x'3ff3c0c1fc8f3238'),
1125  (x'3ff3c0c9539b8887'),
1126  (x'3ff3c0ca2a5b1d5d'),
1127  (x'3ff3c0ca4283de1b'),
1128  (x'3ff3c0ca43db770a'),
1129  (x'3ff3c0ca428abd53'),
1130  (x'3ff3c0ca428c1d2b'),
1131  (x'3ff3c0ca428c51f2'),
1132  (x'3ff3c0ca428c58fc'),
1133  (x'3ff3c0ca428c59dd'),
1134  (x'3ff3c0ca428c59f8'),
1135  (x'3ff3c0ca428c59fb'),
1136  -- 32-bit chunking
1137  (x'40112e0be8047a7d'),
1138  (x'40112e0be815a889'),
1139  (x'40112e0be826d695'),
1140  (x'40112e0be83804a1'),
1141  (x'40112e0be84932ad'),
1142  -- MinMaxShift
1143  (x'0040000000000000'),
1144  (x'007fffffffffffff'),
1145  (x'0290000000000000'),
1146  (x'029fffffffffffff'),
1147  (x'4350000000000000'),
1148  (x'435fffffffffffff'),
1149  (x'1330000000000000'),
1150  (x'133fffffffffffff'),
1151  (x'3a6fa7161a4d6e0c')
1152)
1153select float8send(flt) as ibits,
1154       flt,
1155       flt::text::float8 as r_flt,
1156       float8send(flt::text::float8) as obits,
1157       float8send(flt::text::float8) = float8send(flt) as correct
1158  from (select bits::bigint::xfloat8::float8 as flt
1159          from testdata
1160	offset 0) s;
1161       ibits        |           flt           |          r_flt          |       obits        | correct
1162--------------------+-------------------------+-------------------------+--------------------+---------
1163 \x0000000000000000 |                       0 |                       0 | \x0000000000000000 | t
1164 \x0010000000000000 | 2.2250738585072014e-308 | 2.2250738585072014e-308 | \x0010000000000000 | t
1165 \x0010000000000001 |  2.225073858507202e-308 |  2.225073858507202e-308 | \x0010000000000001 | t
1166 \x0010000000000002 | 2.2250738585072024e-308 | 2.2250738585072024e-308 | \x0010000000000002 | t
1167 \x0018000000000000 |  3.337610787760802e-308 |  3.337610787760802e-308 | \x0018000000000000 | t
1168 \x3ddb7cdfd9d7bdba |   9.999999999999999e-11 |   9.999999999999999e-11 | \x3ddb7cdfd9d7bdba | t
1169 \x3ddb7cdfd9d7bdbb |                   1e-10 |                   1e-10 | \x3ddb7cdfd9d7bdbb | t
1170 \x3ddb7cdfd9d7bdbc |  1.0000000000000002e-10 |  1.0000000000000002e-10 | \x3ddb7cdfd9d7bdbc | t
1171 \x3e112e0be826d694 |   9.999999999999999e-10 |   9.999999999999999e-10 | \x3e112e0be826d694 | t
1172 \x3e112e0be826d695 |                   1e-09 |                   1e-09 | \x3e112e0be826d695 | t
1173 \x3e112e0be826d696 |  1.0000000000000003e-09 |  1.0000000000000003e-09 | \x3e112e0be826d696 | t
1174 \x3e45798ee2308c39 |   9.999999999999999e-09 |   9.999999999999999e-09 | \x3e45798ee2308c39 | t
1175 \x3e45798ee2308c3a |                   1e-08 |                   1e-08 | \x3e45798ee2308c3a | t
1176 \x3e45798ee2308c3b |  1.0000000000000002e-08 |  1.0000000000000002e-08 | \x3e45798ee2308c3b | t
1177 \x3e7ad7f29abcaf47 |   9.999999999999998e-08 |   9.999999999999998e-08 | \x3e7ad7f29abcaf47 | t
1178 \x3e7ad7f29abcaf48 |                   1e-07 |                   1e-07 | \x3e7ad7f29abcaf48 | t
1179 \x3e7ad7f29abcaf49 |  1.0000000000000001e-07 |  1.0000000000000001e-07 | \x3e7ad7f29abcaf49 | t
1180 \x3eb0c6f7a0b5ed8c |   9.999999999999997e-07 |   9.999999999999997e-07 | \x3eb0c6f7a0b5ed8c | t
1181 \x3eb0c6f7a0b5ed8d |                   1e-06 |                   1e-06 | \x3eb0c6f7a0b5ed8d | t
1182 \x3eb0c6f7a0b5ed8e |  1.0000000000000002e-06 |  1.0000000000000002e-06 | \x3eb0c6f7a0b5ed8e | t
1183 \x3ee4f8b588e368ef |   9.999999999999997e-06 |   9.999999999999997e-06 | \x3ee4f8b588e368ef | t
1184 \x3ee4f8b588e368f0 |   9.999999999999999e-06 |   9.999999999999999e-06 | \x3ee4f8b588e368f0 | t
1185 \x3ee4f8b588e368f1 |                   1e-05 |                   1e-05 | \x3ee4f8b588e368f1 | t
1186 \x3f1a36e2eb1c432c |   9.999999999999999e-05 |   9.999999999999999e-05 | \x3f1a36e2eb1c432c | t
1187 \x3f1a36e2eb1c432d |                  0.0001 |                  0.0001 | \x3f1a36e2eb1c432d | t
1188 \x3f1a36e2eb1c432e |  0.00010000000000000002 |  0.00010000000000000002 | \x3f1a36e2eb1c432e | t
1189 \x3f50624dd2f1a9fb |   0.0009999999999999998 |   0.0009999999999999998 | \x3f50624dd2f1a9fb | t
1190 \x3f50624dd2f1a9fc |                   0.001 |                   0.001 | \x3f50624dd2f1a9fc | t
1191 \x3f50624dd2f1a9fd |   0.0010000000000000002 |   0.0010000000000000002 | \x3f50624dd2f1a9fd | t
1192 \x3f847ae147ae147a |    0.009999999999999998 |    0.009999999999999998 | \x3f847ae147ae147a | t
1193 \x3f847ae147ae147b |                    0.01 |                    0.01 | \x3f847ae147ae147b | t
1194 \x3f847ae147ae147c |    0.010000000000000002 |    0.010000000000000002 | \x3f847ae147ae147c | t
1195 \x3fb9999999999999 |     0.09999999999999999 |     0.09999999999999999 | \x3fb9999999999999 | t
1196 \x3fb999999999999a |                     0.1 |                     0.1 | \x3fb999999999999a | t
1197 \x3fb999999999999b |     0.10000000000000002 |     0.10000000000000002 | \x3fb999999999999b | t
1198 \x3feffffffffffff0 |      0.9999999999999982 |      0.9999999999999982 | \x3feffffffffffff0 | t
1199 \x3feffffffffffff1 |      0.9999999999999983 |      0.9999999999999983 | \x3feffffffffffff1 | t
1200 \x3feffffffffffff2 |      0.9999999999999984 |      0.9999999999999984 | \x3feffffffffffff2 | t
1201 \x3feffffffffffff3 |      0.9999999999999986 |      0.9999999999999986 | \x3feffffffffffff3 | t
1202 \x3feffffffffffff4 |      0.9999999999999987 |      0.9999999999999987 | \x3feffffffffffff4 | t
1203 \x3feffffffffffff5 |      0.9999999999999988 |      0.9999999999999988 | \x3feffffffffffff5 | t
1204 \x3feffffffffffff6 |      0.9999999999999989 |      0.9999999999999989 | \x3feffffffffffff6 | t
1205 \x3feffffffffffff7 |       0.999999999999999 |       0.999999999999999 | \x3feffffffffffff7 | t
1206 \x3feffffffffffff8 |      0.9999999999999991 |      0.9999999999999991 | \x3feffffffffffff8 | t
1207 \x3feffffffffffff9 |      0.9999999999999992 |      0.9999999999999992 | \x3feffffffffffff9 | t
1208 \x3feffffffffffffa |      0.9999999999999993 |      0.9999999999999993 | \x3feffffffffffffa | t
1209 \x3feffffffffffffb |      0.9999999999999994 |      0.9999999999999994 | \x3feffffffffffffb | t
1210 \x3feffffffffffffc |      0.9999999999999996 |      0.9999999999999996 | \x3feffffffffffffc | t
1211 \x3feffffffffffffd |      0.9999999999999997 |      0.9999999999999997 | \x3feffffffffffffd | t
1212 \x3feffffffffffffe |      0.9999999999999998 |      0.9999999999999998 | \x3feffffffffffffe | t
1213 \x3fefffffffffffff |      0.9999999999999999 |      0.9999999999999999 | \x3fefffffffffffff | t
1214 \x3ff0000000000000 |                       1 |                       1 | \x3ff0000000000000 | t
1215 \x3ff0000000000001 |      1.0000000000000002 |      1.0000000000000002 | \x3ff0000000000001 | t
1216 \x3ff0000000000002 |      1.0000000000000004 |      1.0000000000000004 | \x3ff0000000000002 | t
1217 \x3ff0000000000003 |      1.0000000000000007 |      1.0000000000000007 | \x3ff0000000000003 | t
1218 \x3ff0000000000004 |      1.0000000000000009 |      1.0000000000000009 | \x3ff0000000000004 | t
1219 \x3ff0000000000005 |       1.000000000000001 |       1.000000000000001 | \x3ff0000000000005 | t
1220 \x3ff0000000000006 |      1.0000000000000013 |      1.0000000000000013 | \x3ff0000000000006 | t
1221 \x3ff0000000000007 |      1.0000000000000016 |      1.0000000000000016 | \x3ff0000000000007 | t
1222 \x3ff0000000000008 |      1.0000000000000018 |      1.0000000000000018 | \x3ff0000000000008 | t
1223 \x3ff0000000000009 |       1.000000000000002 |       1.000000000000002 | \x3ff0000000000009 | t
1224 \x3ff921fb54442d18 |      1.5707963267948966 |      1.5707963267948966 | \x3ff921fb54442d18 | t
1225 \x4005bf0a8b14576a |      2.7182818284590455 |      2.7182818284590455 | \x4005bf0a8b14576a | t
1226 \x400921fb54442d18 |       3.141592653589793 |       3.141592653589793 | \x400921fb54442d18 | t
1227 \x4023ffffffffffff |       9.999999999999998 |       9.999999999999998 | \x4023ffffffffffff | t
1228 \x4024000000000000 |                      10 |                      10 | \x4024000000000000 | t
1229 \x4024000000000001 |      10.000000000000002 |      10.000000000000002 | \x4024000000000001 | t
1230 \x4058ffffffffffff |       99.99999999999999 |       99.99999999999999 | \x4058ffffffffffff | t
1231 \x4059000000000000 |                     100 |                     100 | \x4059000000000000 | t
1232 \x4059000000000001 |      100.00000000000001 |      100.00000000000001 | \x4059000000000001 | t
1233 \x408f3fffffffffff |       999.9999999999999 |       999.9999999999999 | \x408f3fffffffffff | t
1234 \x408f400000000000 |                    1000 |                    1000 | \x408f400000000000 | t
1235 \x408f400000000001 |      1000.0000000000001 |      1000.0000000000001 | \x408f400000000001 | t
1236 \x40c387ffffffffff |       9999.999999999998 |       9999.999999999998 | \x40c387ffffffffff | t
1237 \x40c3880000000000 |                   10000 |                   10000 | \x40c3880000000000 | t
1238 \x40c3880000000001 |      10000.000000000002 |      10000.000000000002 | \x40c3880000000001 | t
1239 \x40f869ffffffffff |       99999.99999999999 |       99999.99999999999 | \x40f869ffffffffff | t
1240 \x40f86a0000000000 |                  100000 |                  100000 | \x40f86a0000000000 | t
1241 \x40f86a0000000001 |      100000.00000000001 |      100000.00000000001 | \x40f86a0000000001 | t
1242 \x412e847fffffffff |       999999.9999999999 |       999999.9999999999 | \x412e847fffffffff | t
1243 \x412e848000000000 |                 1000000 |                 1000000 | \x412e848000000000 | t
1244 \x412e848000000001 |      1000000.0000000001 |      1000000.0000000001 | \x412e848000000001 | t
1245 \x416312cfffffffff |       9999999.999999998 |       9999999.999999998 | \x416312cfffffffff | t
1246 \x416312d000000000 |                10000000 |                10000000 | \x416312d000000000 | t
1247 \x416312d000000001 |      10000000.000000002 |      10000000.000000002 | \x416312d000000001 | t
1248 \x4197d783ffffffff |       99999999.99999999 |       99999999.99999999 | \x4197d783ffffffff | t
1249 \x4197d78400000000 |               100000000 |               100000000 | \x4197d78400000000 | t
1250 \x4197d78400000001 |      100000000.00000001 |      100000000.00000001 | \x4197d78400000001 | t
1251 \x41cdcd64ffffffff |       999999999.9999999 |       999999999.9999999 | \x41cdcd64ffffffff | t
1252 \x41cdcd6500000000 |              1000000000 |              1000000000 | \x41cdcd6500000000 | t
1253 \x41cdcd6500000001 |      1000000000.0000001 |      1000000000.0000001 | \x41cdcd6500000001 | t
1254 \x4202a05f1fffffff |       9999999999.999998 |       9999999999.999998 | \x4202a05f1fffffff | t
1255 \x4202a05f20000000 |             10000000000 |             10000000000 | \x4202a05f20000000 | t
1256 \x4202a05f20000001 |      10000000000.000002 |      10000000000.000002 | \x4202a05f20000001 | t
1257 \x42374876e7ffffff |       99999999999.99998 |       99999999999.99998 | \x42374876e7ffffff | t
1258 \x42374876e8000000 |            100000000000 |            100000000000 | \x42374876e8000000 | t
1259 \x42374876e8000001 |      100000000000.00002 |      100000000000.00002 | \x42374876e8000001 | t
1260 \x426d1a94a1ffffff |       999999999999.9999 |       999999999999.9999 | \x426d1a94a1ffffff | t
1261 \x426d1a94a2000000 |           1000000000000 |           1000000000000 | \x426d1a94a2000000 | t
1262 \x426d1a94a2000001 |      1000000000000.0001 |      1000000000000.0001 | \x426d1a94a2000001 | t
1263 \x42a2309ce53fffff |       9999999999999.998 |       9999999999999.998 | \x42a2309ce53fffff | t
1264 \x42a2309ce5400000 |          10000000000000 |          10000000000000 | \x42a2309ce5400000 | t
1265 \x42a2309ce5400001 |      10000000000000.002 |      10000000000000.002 | \x42a2309ce5400001 | t
1266 \x42d6bcc41e8fffff |       99999999999999.98 |       99999999999999.98 | \x42d6bcc41e8fffff | t
1267 \x42d6bcc41e900000 |         100000000000000 |         100000000000000 | \x42d6bcc41e900000 | t
1268 \x42d6bcc41e900001 |      100000000000000.02 |      100000000000000.02 | \x42d6bcc41e900001 | t
1269 \x430c6bf52633ffff |       999999999999999.9 |       999999999999999.9 | \x430c6bf52633ffff | t
1270 \x430c6bf526340000 |                   1e+15 |                   1e+15 | \x430c6bf526340000 | t
1271 \x430c6bf526340001 |  1.0000000000000001e+15 |  1.0000000000000001e+15 | \x430c6bf526340001 | t
1272 \x4341c37937e07fff |   9.999999999999998e+15 |   9.999999999999998e+15 | \x4341c37937e07fff | t
1273 \x4341c37937e08000 |                   1e+16 |                   1e+16 | \x4341c37937e08000 | t
1274 \x4341c37937e08001 |  1.0000000000000002e+16 |  1.0000000000000002e+16 | \x4341c37937e08001 | t
1275 \x4376345785d89fff |   9.999999999999998e+16 |   9.999999999999998e+16 | \x4376345785d89fff | t
1276 \x4376345785d8a000 |                   1e+17 |                   1e+17 | \x4376345785d8a000 | t
1277 \x4376345785d8a001 |  1.0000000000000002e+17 |  1.0000000000000002e+17 | \x4376345785d8a001 | t
1278 \x43abc16d674ec7ff |   9.999999999999999e+17 |   9.999999999999999e+17 | \x43abc16d674ec7ff | t
1279 \x43abc16d674ec800 |                   1e+18 |                   1e+18 | \x43abc16d674ec800 | t
1280 \x43abc16d674ec801 |  1.0000000000000001e+18 |  1.0000000000000001e+18 | \x43abc16d674ec801 | t
1281 \x43e158e460913cff |   9.999999999999998e+18 |   9.999999999999998e+18 | \x43e158e460913cff | t
1282 \x43e158e460913d00 |                   1e+19 |                   1e+19 | \x43e158e460913d00 | t
1283 \x43e158e460913d01 |  1.0000000000000002e+19 |  1.0000000000000002e+19 | \x43e158e460913d01 | t
1284 \x4415af1d78b58c3f |   9.999999999999998e+19 |   9.999999999999998e+19 | \x4415af1d78b58c3f | t
1285 \x4415af1d78b58c40 |                   1e+20 |                   1e+20 | \x4415af1d78b58c40 | t
1286 \x4415af1d78b58c41 |  1.0000000000000002e+20 |  1.0000000000000002e+20 | \x4415af1d78b58c41 | t
1287 \x444b1ae4d6e2ef4f |   9.999999999999999e+20 |   9.999999999999999e+20 | \x444b1ae4d6e2ef4f | t
1288 \x444b1ae4d6e2ef50 |                   1e+21 |                   1e+21 | \x444b1ae4d6e2ef50 | t
1289 \x444b1ae4d6e2ef51 |  1.0000000000000001e+21 |  1.0000000000000001e+21 | \x444b1ae4d6e2ef51 | t
1290 \x4480f0cf064dd591 |   9.999999999999998e+21 |   9.999999999999998e+21 | \x4480f0cf064dd591 | t
1291 \x4480f0cf064dd592 |                   1e+22 |                   1e+22 | \x4480f0cf064dd592 | t
1292 \x4480f0cf064dd593 |  1.0000000000000002e+22 |  1.0000000000000002e+22 | \x4480f0cf064dd593 | t
1293 \x44b52d02c7e14af5 |   9.999999999999997e+22 |   9.999999999999997e+22 | \x44b52d02c7e14af5 | t
1294 \x44b52d02c7e14af6 |   9.999999999999999e+22 |   9.999999999999999e+22 | \x44b52d02c7e14af6 | t
1295 \x44b52d02c7e14af7 |  1.0000000000000001e+23 |  1.0000000000000001e+23 | \x44b52d02c7e14af7 | t
1296 \x44ea784379d99db3 |   9.999999999999998e+23 |   9.999999999999998e+23 | \x44ea784379d99db3 | t
1297 \x44ea784379d99db4 |                   1e+24 |                   1e+24 | \x44ea784379d99db4 | t
1298 \x44ea784379d99db5 |  1.0000000000000001e+24 |  1.0000000000000001e+24 | \x44ea784379d99db5 | t
1299 \x45208b2a2c280290 |   9.999999999999999e+24 |   9.999999999999999e+24 | \x45208b2a2c280290 | t
1300 \x45208b2a2c280291 |                   1e+25 |                   1e+25 | \x45208b2a2c280291 | t
1301 \x45208b2a2c280292 |  1.0000000000000003e+25 |  1.0000000000000003e+25 | \x45208b2a2c280292 | t
1302 \x7feffffffffffffe | 1.7976931348623155e+308 | 1.7976931348623155e+308 | \x7feffffffffffffe | t
1303 \x7fefffffffffffff | 1.7976931348623157e+308 | 1.7976931348623157e+308 | \x7fefffffffffffff | t
1304 \x4350000000000002 |  1.8014398509481992e+16 |  1.8014398509481992e+16 | \x4350000000000002 | t
1305 \x4350000000002e06 |  1.8014398509529112e+16 |  1.8014398509529112e+16 | \x4350000000002e06 | t
1306 \x4352000000000003 |  2.0266198323167244e+16 |  2.0266198323167244e+16 | \x4352000000000003 | t
1307 \x4352000000000004 |  2.0266198323167248e+16 |  2.0266198323167248e+16 | \x4352000000000004 | t
1308 \x4358000000000003 |  2.7021597764222988e+16 |  2.7021597764222988e+16 | \x4358000000000003 | t
1309 \x4358000000000004 |  2.7021597764222992e+16 |  2.7021597764222992e+16 | \x4358000000000004 | t
1310 \x435f000000000020 |  3.4902897112121472e+16 |  3.4902897112121472e+16 | \x435f000000000020 | t
1311 \xc350000000000002 | -1.8014398509481992e+16 | -1.8014398509481992e+16 | \xc350000000000002 | t
1312 \xc350000000002e06 | -1.8014398509529112e+16 | -1.8014398509529112e+16 | \xc350000000002e06 | t
1313 \xc352000000000003 | -2.0266198323167244e+16 | -2.0266198323167244e+16 | \xc352000000000003 | t
1314 \xc352000000000004 | -2.0266198323167248e+16 | -2.0266198323167248e+16 | \xc352000000000004 | t
1315 \xc358000000000003 | -2.7021597764222988e+16 | -2.7021597764222988e+16 | \xc358000000000003 | t
1316 \xc358000000000004 | -2.7021597764222992e+16 | -2.7021597764222992e+16 | \xc358000000000004 | t
1317 \xc35f000000000020 | -3.4902897112121472e+16 | -3.4902897112121472e+16 | \xc35f000000000020 | t
1318 \x42dc12218377de66 |       123456789012345.6 |       123456789012345.6 | \x42dc12218377de66 | t
1319 \x42a674e79c5fe51f |       12345678901234.56 |       12345678901234.56 | \x42a674e79c5fe51f | t
1320 \x4271f71fb04cb74c |       1234567890123.456 |       1234567890123.456 | \x4271f71fb04cb74c | t
1321 \x423cbe991a145879 |       123456789012.3456 |       123456789012.3456 | \x423cbe991a145879 | t
1322 \x4206fee0e1a9e061 |       12345678901.23456 |       12345678901.23456 | \x4206fee0e1a9e061 | t
1323 \x41d26580b487e6b4 |       1234567890.123456 |       1234567890.123456 | \x41d26580b487e6b4 | t
1324 \x419d6f34540ca453 |       123456789.0123456 |       123456789.0123456 | \x419d6f34540ca453 | t
1325 \x41678c29dcd6e9dc |       12345678.90123456 |       12345678.90123456 | \x41678c29dcd6e9dc | t
1326 \x4132d687e3df217d |       1234567.890123456 |       1234567.890123456 | \x4132d687e3df217d | t
1327 \x40fe240c9fcb68c8 |       123456.7890123456 |       123456.7890123456 | \x40fe240c9fcb68c8 | t
1328 \x40c81cd6e63c53d3 |       12345.67890123456 |       12345.67890123456 | \x40c81cd6e63c53d3 | t
1329 \x40934a4584fd0fdc |       1234.567890123456 |       1234.567890123456 | \x40934a4584fd0fdc | t
1330 \x405edd3c07fb4c93 |       123.4567890123456 |       123.4567890123456 | \x405edd3c07fb4c93 | t
1331 \x4028b0fcd32f7076 |       12.34567890123456 |       12.34567890123456 | \x4028b0fcd32f7076 | t
1332 \x3ff3c0ca428c59f8 |       1.234567890123456 |       1.234567890123456 | \x3ff3c0ca428c59f8 | t
1333 \x3e60000000000000 |  2.9802322387695312e-08 |  2.9802322387695312e-08 | \x3e60000000000000 | t
1334 \xc352bd2668e077c4 | -2.1098088986959632e+16 | -2.1098088986959632e+16 | \xc352bd2668e077c4 | t
1335 \x434018601510c000 |     9.0608011534336e+15 |     9.0608011534336e+15 | \x434018601510c000 | t
1336 \x43d055dc36f24000 |   4.708356024711512e+18 |   4.708356024711512e+18 | \x43d055dc36f24000 | t
1337 \x43e052961c6f8000 |   9.409340012568248e+18 |   9.409340012568248e+18 | \x43e052961c6f8000 | t
1338 \x3ff3c0ca2a5b1d5d |               1.2345678 |               1.2345678 | \x3ff3c0ca2a5b1d5d | t
1339 \x4830f0cf064dd592 |   5.764607523034235e+39 |   5.764607523034235e+39 | \x4830f0cf064dd592 | t
1340 \x4840f0cf064dd592 |   1.152921504606847e+40 |   1.152921504606847e+40 | \x4840f0cf064dd592 | t
1341 \x4850f0cf064dd592 |   2.305843009213694e+40 |   2.305843009213694e+40 | \x4850f0cf064dd592 | t
1342 \x3ff3333333333333 |                     1.2 |                     1.2 | \x3ff3333333333333 | t
1343 \x3ff3ae147ae147ae |                    1.23 |                    1.23 | \x3ff3ae147ae147ae | t
1344 \x3ff3be76c8b43958 |                   1.234 |                   1.234 | \x3ff3be76c8b43958 | t
1345 \x3ff3c083126e978d |                  1.2345 |                  1.2345 | \x3ff3c083126e978d | t
1346 \x3ff3c0c1fc8f3238 |                 1.23456 |                 1.23456 | \x3ff3c0c1fc8f3238 | t
1347 \x3ff3c0c9539b8887 |                1.234567 |                1.234567 | \x3ff3c0c9539b8887 | t
1348 \x3ff3c0ca2a5b1d5d |               1.2345678 |               1.2345678 | \x3ff3c0ca2a5b1d5d | t
1349 \x3ff3c0ca4283de1b |              1.23456789 |              1.23456789 | \x3ff3c0ca4283de1b | t
1350 \x3ff3c0ca43db770a |             1.234567895 |             1.234567895 | \x3ff3c0ca43db770a | t
1351 \x3ff3c0ca428abd53 |            1.2345678901 |            1.2345678901 | \x3ff3c0ca428abd53 | t
1352 \x3ff3c0ca428c1d2b |           1.23456789012 |           1.23456789012 | \x3ff3c0ca428c1d2b | t
1353 \x3ff3c0ca428c51f2 |          1.234567890123 |          1.234567890123 | \x3ff3c0ca428c51f2 | t
1354 \x3ff3c0ca428c58fc |         1.2345678901234 |         1.2345678901234 | \x3ff3c0ca428c58fc | t
1355 \x3ff3c0ca428c59dd |        1.23456789012345 |        1.23456789012345 | \x3ff3c0ca428c59dd | t
1356 \x3ff3c0ca428c59f8 |       1.234567890123456 |       1.234567890123456 | \x3ff3c0ca428c59f8 | t
1357 \x3ff3c0ca428c59fb |      1.2345678901234567 |      1.2345678901234567 | \x3ff3c0ca428c59fb | t
1358 \x40112e0be8047a7d |             4.294967294 |             4.294967294 | \x40112e0be8047a7d | t
1359 \x40112e0be815a889 |             4.294967295 |             4.294967295 | \x40112e0be815a889 | t
1360 \x40112e0be826d695 |             4.294967296 |             4.294967296 | \x40112e0be826d695 | t
1361 \x40112e0be83804a1 |             4.294967297 |             4.294967297 | \x40112e0be83804a1 | t
1362 \x40112e0be84932ad |             4.294967298 |             4.294967298 | \x40112e0be84932ad | t
1363 \x0040000000000000 | 1.7800590868057611e-307 | 1.7800590868057611e-307 | \x0040000000000000 | t
1364 \x007fffffffffffff | 2.8480945388892175e-306 | 2.8480945388892175e-306 | \x007fffffffffffff | t
1365 \x0290000000000000 |  2.446494580089078e-296 |  2.446494580089078e-296 | \x0290000000000000 | t
1366 \x029fffffffffffff | 4.8929891601781557e-296 | 4.8929891601781557e-296 | \x029fffffffffffff | t
1367 \x4350000000000000 |  1.8014398509481984e+16 |  1.8014398509481984e+16 | \x4350000000000000 | t
1368 \x435fffffffffffff |  3.6028797018963964e+16 |  3.6028797018963964e+16 | \x435fffffffffffff | t
1369 \x1330000000000000 |  2.900835519859558e-216 |  2.900835519859558e-216 | \x1330000000000000 | t
1370 \x133fffffffffffff |  5.801671039719115e-216 |  5.801671039719115e-216 | \x133fffffffffffff | t
1371 \x3a6fa7161a4d6e0c |   3.196104012172126e-27 |   3.196104012172126e-27 | \x3a6fa7161a4d6e0c | t
1372(209 rows)
1373
1374-- clean up, lest opr_sanity complain
1375drop type xfloat8 cascade;
1376NOTICE:  drop cascades to 6 other objects
1377DETAIL:  drop cascades to function xfloat8in(cstring)
1378drop cascades to function xfloat8out(xfloat8)
1379drop cascades to cast from xfloat8 to double precision
1380drop cascades to cast from double precision to xfloat8
1381drop cascades to cast from xfloat8 to bigint
1382drop cascades to cast from bigint to xfloat8
1383