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