/ Check-in [e1814452]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Additional test cases for the tointeger() and toreal() SQL functions when converting from a BLOB.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | toTypeFuncs
Files: files | file ages | folders
SHA1: e1814452faa698946ef77f06a42665277ee59cc1
User & Date: mistachkin 2013-09-04 00:58:00
Context
2013-09-06
20:30
When converting from a BLOB value in the tointeger() and toreal() SQL functions, make sure that endianness of the machine does not matter. check-in: 94c4cdc5 user: mistachkin tags: toTypeFuncs
2013-09-04
00:58
Additional test cases for the tointeger() and toreal() SQL functions when converting from a BLOB. check-in: e1814452 user: mistachkin tags: toTypeFuncs
2013-09-01
23:36
Merge updates from trunk. check-in: 2982725e user: mistachkin tags: toTypeFuncs
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/func4.test.

16
17
18
19
20
21
22



23
24
25
26
27
28
29
...
124
125
126
127
128
129
130

131
132
133

134
135
136
137
138
139
140
...
160
161
162
163
164
165
166

167
168
169
170
171
172
173
174
175
176
177
178

179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
...
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
...
292
293
294
295
296
297
298
299
300
301
302

303
304
305

306
307
308
309
310
311
312
...
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344

345
346
347
348
349
350

351
352
353
354
355
356
357
...
446
447
448
449
450
451
452

453
454
455
456
457

458
459
460
461
462
463
464
...
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
...
585
586
587
588
589
590
591

592
593
594
595
596
597

598
599
600
601
602
603
604
...
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620

621
622
623
624
625
626
627
628
629

630
631
632
633
634
635
636
637
638
639
640



























































































































641
642
643
# expression arguments as double precision floating point values.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set saved_tcl_precision $tcl_precision
set tcl_precision 0




do_execsql_test func4-1.1 {
  SELECT tointeger(NULL);
} {{}}
do_execsql_test func4-1.2 {
  SELECT tointeger('');
} {{}}
do_execsql_test func4-1.3 {
................................................................................
} {2147483648}
do_execsql_test func4-1.35 {
  SELECT tointeger(9223372036854775807 - 1);
} {9223372036854775806}
do_execsql_test func4-1.36 {
  SELECT tointeger(9223372036854775807);
} {9223372036854775807}

do_execsql_test func4-1.37 {
  SELECT tointeger(9223372036854775807 + 1);
} {{}}

do_execsql_test func4-1.38 {
  SELECT tointeger(1.79769313486232e308 - 1);
} {{}}
do_execsql_test func4-1.39 {
  SELECT tointeger(1.79769313486232e308);
} {{}}
do_execsql_test func4-1.40 {
................................................................................
} {9007199254740993}
do_execsql_test func4-1.47 {
  SELECT tointeger(9223372036854775807 - 1);
} {9223372036854775806}
do_execsql_test func4-1.48 {
  SELECT tointeger(9223372036854775807);
} {9223372036854775807}

do_execsql_test func4-1.49 {
  SELECT tointeger(9223372036854775807 + 1);
} {{}}
do_execsql_test func4-1.50 {
  SELECT tointeger(9223372036854775808 - 1);
} {{}}
do_execsql_test func4-1.51 {
  SELECT tointeger(9223372036854775808);
} {{}}
do_execsql_test func4-1.52 {
  SELECT tointeger(9223372036854775808 + 1);
} {{}}

do_execsql_test func4-1.53 {
  SELECT tointeger(18446744073709551616 - 1);
} {{}}
do_execsql_test func4-1.54 {
  SELECT tointeger(18446744073709551616);
} {{}}
do_execsql_test func4-1.55 {
  SELECT tointeger(18446744073709551616 + 1);
} {{}}

ifcapable floatingpoint {
  set highPrecision [expr \
      {[memdbsql {SELECT toreal(-9223372036854775808 + 1);}] eq {{}}}]

  do_execsql_test func4-2.1 {
    SELECT toreal(NULL);
  } {{}}
  do_execsql_test func4-2.2 {
    SELECT toreal('');
................................................................................
  } {-Inf}
  do_execsql_test func4-2.23 {
    SELECT toreal(-9223372036854775808 - 1);
  } {-9.223372036854776e+18}
  do_execsql_test func4-2.24 {
    SELECT toreal(-9223372036854775808);
  } {-9.223372036854776e+18}
  if {$highPrecision} {
    do_execsql_test func4-2.25 {
      SELECT toreal(-9223372036854775808 + 1);
    } {{}}
  }
  do_execsql_test func4-2.26 {
    SELECT toreal(-9223372036854775807 - 1);
  } {-9.223372036854776e+18}
  if {$highPrecision} {
    do_execsql_test func4-2.27 {
      SELECT toreal(-9223372036854775807);
    } {{}}
    do_execsql_test func4-2.28 {
      SELECT toreal(-9223372036854775807 + 1);
    } {{}}
  }
................................................................................
  } {2147483646.0}
  do_execsql_test func4-2.33 {
    SELECT toreal(2147483647);
  } {2147483647.0}
  do_execsql_test func4-2.34 {
    SELECT toreal(2147483647 + 1);
  } {2147483648.0}
  if {$highPrecision} {
    do_execsql_test func4-2.35 {
      SELECT toreal(9223372036854775807 - 1);
    } {{}}

    do_execsql_test func4-2.36 {
      SELECT toreal(9223372036854775807);
    } {{}}

  }
  do_execsql_test func4-2.37 {
    SELECT toreal(9223372036854775807 + 1);
  } {9.223372036854776e+18}
  do_execsql_test func4-2.38 {
    SELECT toreal(1.79769313486232e308 - 1);
  } {Inf}
................................................................................
  } {4503599627370497.0}
  do_execsql_test func4-2.44 {
    SELECT toreal(9007199254740992 - 1);
  } {9007199254740991.0}
  do_execsql_test func4-2.45 {
    SELECT toreal(9007199254740992);
  } {9007199254740992.0}
  if {$highPrecision} {
    do_execsql_test func4-2.46 {
      SELECT toreal(9007199254740992 + 1);
    } {{}}
  }
  do_execsql_test func4-2.47 {
    SELECT toreal(9007199254740992 + 2);
  } {9007199254740994.0}
  do_execsql_test func4-2.48 {
    SELECT toreal(tointeger(9223372036854775808) - 1);
  } {{}}

  do_execsql_test func4-2.49 {
    SELECT toreal(tointeger(9223372036854775808));
  } {{}}
  do_execsql_test func4-2.50 {
    SELECT toreal(tointeger(9223372036854775808) + 1);
  } {{}}

  do_execsql_test func4-2.51 {
    SELECT toreal(tointeger(18446744073709551616) - 1);
  } {{}}
  do_execsql_test func4-2.52 {
    SELECT toreal(tointeger(18446744073709551616));
  } {{}}
  do_execsql_test func4-2.53 {
................................................................................
    }
  } {0 {}}
  do_test func4-3.18 {
    catchsql {
      INSERT INTO t1 (x) VALUES ('-9223372036854775809');
    }
  } {1 {constraint failed}}

  do_test func4-3.19 {
    catchsql {
      INSERT INTO t1 (x) VALUES (9223372036854775808);
    }
  } {1 {constraint failed}}

  do_execsql_test func4-3.20 {
    SELECT x FROM t1 ORDER BY x;
  } {1234 1234 1234}

  ifcapable floatingpoint {
    do_execsql_test func4-4.1 {
      CREATE TABLE t2(
................................................................................
  } {1}
  do_execsql_test func4-5.6 {
    SELECT tointeger(toreal(-9223372036854775808 - 1));
  } {-9223372036854775808}
  do_execsql_test func4-5.7 {
    SELECT tointeger(toreal(-9223372036854775808));
  } {-9223372036854775808}
  if {$highPrecision} {
    do_execsql_test func4-5.8 {
      SELECT tointeger(toreal(-9223372036854775808 + 1));
    } {{}}
  }
  do_execsql_test func4-5.9 {
    SELECT tointeger(toreal(-2147483648 - 1));
  } {-2147483649}
................................................................................
  } {2147483647}
  do_execsql_test func4-5.14 {
    SELECT tointeger(toreal(2147483647 + 1));
  } {2147483648}
  do_execsql_test func4-5.15 {
    SELECT tointeger(toreal(9223372036854775807 - 1));
  } {{}}

  do_execsql_test func4-5.16 {
    SELECT tointeger(toreal(9223372036854775807));
  } {{}}
  do_execsql_test func4-5.17 {
    SELECT tointeger(toreal(9223372036854775807 + 1));
  } {{}}

  do_execsql_test func4-5.18 {
    SELECT tointeger(toreal(4503599627370496 - 1));
  } {4503599627370495}
  do_execsql_test func4-5.19 {
    SELECT tointeger(toreal(4503599627370496));
  } {4503599627370496}
  do_execsql_test func4-5.20 {
................................................................................
  } {4503599627370497}
  do_execsql_test func4-5.21 {
    SELECT tointeger(toreal(9007199254740992 - 1));
  } {9007199254740991}
  do_execsql_test func4-5.22 {
    SELECT tointeger(toreal(9007199254740992));
  } {9007199254740992}
  if {$highPrecision} {
    do_execsql_test func4-5.23 {
      SELECT tointeger(toreal(9007199254740992 + 1));
    } {{}}
  }
  do_execsql_test func4-5.24 {
    SELECT tointeger(toreal(9007199254740992 + 2));
  } {9007199254740994}

  do_execsql_test func4-5.25 {
    SELECT tointeger(toreal(9223372036854775808 - 1));
  } {{}}
  do_execsql_test func4-5.26 {
    SELECT tointeger(toreal(9223372036854775808));
  } {{}}
  do_execsql_test func4-5.27 {
    SELECT tointeger(toreal(9223372036854775808 + 1));
  } {{}}

  do_execsql_test func4-5.28 {
    SELECT tointeger(toreal(18446744073709551616 - 1));
  } {{}}
  do_execsql_test func4-5.29 {
    SELECT tointeger(toreal(18446744073709551616));
  } {{}}
  do_execsql_test func4-5.30 {
    SELECT tointeger(toreal(18446744073709551616 + 1));
  } {{}}
}




























































































































set tcl_precision $saved_tcl_precision
unset saved_tcl_precision
finish_test







>
>
>







 







>
|
|
|
>







 







>
|
|
|
|
|
|
|
|
|
|
|
|
>











|







 







|







|







 







|



>
|
|
|
>







 







|










>
|
|
|
|
|
|
>







 







>
|
|
|
|
|
>







 







|







 







>
|
|
|
|
|
|
>







 







|







>
|
|
|
|
|
|
|
|
|
>











>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
...
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
...
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
...
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
...
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
...
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
...
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
...
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
...
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
# expression arguments as double precision floating point values.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set saved_tcl_precision $tcl_precision
set tcl_precision 0

set highPrecision(1) [expr \
    {[memdbsql {SELECT tointeger(9223372036854775807 + 1);}] eq {{}}}]

do_execsql_test func4-1.1 {
  SELECT tointeger(NULL);
} {{}}
do_execsql_test func4-1.2 {
  SELECT tointeger('');
} {{}}
do_execsql_test func4-1.3 {
................................................................................
} {2147483648}
do_execsql_test func4-1.35 {
  SELECT tointeger(9223372036854775807 - 1);
} {9223372036854775806}
do_execsql_test func4-1.36 {
  SELECT tointeger(9223372036854775807);
} {9223372036854775807}
if {$highPrecision(1)} {
  do_execsql_test func4-1.37 {
    SELECT tointeger(9223372036854775807 + 1);
  } {{}}
}
do_execsql_test func4-1.38 {
  SELECT tointeger(1.79769313486232e308 - 1);
} {{}}
do_execsql_test func4-1.39 {
  SELECT tointeger(1.79769313486232e308);
} {{}}
do_execsql_test func4-1.40 {
................................................................................
} {9007199254740993}
do_execsql_test func4-1.47 {
  SELECT tointeger(9223372036854775807 - 1);
} {9223372036854775806}
do_execsql_test func4-1.48 {
  SELECT tointeger(9223372036854775807);
} {9223372036854775807}
if {$highPrecision(1)} {
  do_execsql_test func4-1.49 {
    SELECT tointeger(9223372036854775807 + 1);
  } {{}}
  do_execsql_test func4-1.50 {
    SELECT tointeger(9223372036854775808 - 1);
  } {{}}
  do_execsql_test func4-1.51 {
    SELECT tointeger(9223372036854775808);
  } {{}}
  do_execsql_test func4-1.52 {
    SELECT tointeger(9223372036854775808 + 1);
  } {{}}
}
do_execsql_test func4-1.53 {
  SELECT tointeger(18446744073709551616 - 1);
} {{}}
do_execsql_test func4-1.54 {
  SELECT tointeger(18446744073709551616);
} {{}}
do_execsql_test func4-1.55 {
  SELECT tointeger(18446744073709551616 + 1);
} {{}}

ifcapable floatingpoint {
  set highPrecision(2) [expr \
      {[memdbsql {SELECT toreal(-9223372036854775808 + 1);}] eq {{}}}]

  do_execsql_test func4-2.1 {
    SELECT toreal(NULL);
  } {{}}
  do_execsql_test func4-2.2 {
    SELECT toreal('');
................................................................................
  } {-Inf}
  do_execsql_test func4-2.23 {
    SELECT toreal(-9223372036854775808 - 1);
  } {-9.223372036854776e+18}
  do_execsql_test func4-2.24 {
    SELECT toreal(-9223372036854775808);
  } {-9.223372036854776e+18}
  if {$highPrecision(2)} {
    do_execsql_test func4-2.25 {
      SELECT toreal(-9223372036854775808 + 1);
    } {{}}
  }
  do_execsql_test func4-2.26 {
    SELECT toreal(-9223372036854775807 - 1);
  } {-9.223372036854776e+18}
  if {$highPrecision(2)} {
    do_execsql_test func4-2.27 {
      SELECT toreal(-9223372036854775807);
    } {{}}
    do_execsql_test func4-2.28 {
      SELECT toreal(-9223372036854775807 + 1);
    } {{}}
  }
................................................................................
  } {2147483646.0}
  do_execsql_test func4-2.33 {
    SELECT toreal(2147483647);
  } {2147483647.0}
  do_execsql_test func4-2.34 {
    SELECT toreal(2147483647 + 1);
  } {2147483648.0}
  if {$highPrecision(2)} {
    do_execsql_test func4-2.35 {
      SELECT toreal(9223372036854775807 - 1);
    } {{}}
    if {$highPrecision(1)} {
      do_execsql_test func4-2.36 {
        SELECT toreal(9223372036854775807);
      } {{}}
    }
  }
  do_execsql_test func4-2.37 {
    SELECT toreal(9223372036854775807 + 1);
  } {9.223372036854776e+18}
  do_execsql_test func4-2.38 {
    SELECT toreal(1.79769313486232e308 - 1);
  } {Inf}
................................................................................
  } {4503599627370497.0}
  do_execsql_test func4-2.44 {
    SELECT toreal(9007199254740992 - 1);
  } {9007199254740991.0}
  do_execsql_test func4-2.45 {
    SELECT toreal(9007199254740992);
  } {9007199254740992.0}
  if {$highPrecision(2)} {
    do_execsql_test func4-2.46 {
      SELECT toreal(9007199254740992 + 1);
    } {{}}
  }
  do_execsql_test func4-2.47 {
    SELECT toreal(9007199254740992 + 2);
  } {9007199254740994.0}
  do_execsql_test func4-2.48 {
    SELECT toreal(tointeger(9223372036854775808) - 1);
  } {{}}
  if {$highPrecision(1)} {
    do_execsql_test func4-2.49 {
      SELECT toreal(tointeger(9223372036854775808));
    } {{}}
    do_execsql_test func4-2.50 {
      SELECT toreal(tointeger(9223372036854775808) + 1);
    } {{}}
  }
  do_execsql_test func4-2.51 {
    SELECT toreal(tointeger(18446744073709551616) - 1);
  } {{}}
  do_execsql_test func4-2.52 {
    SELECT toreal(tointeger(18446744073709551616));
  } {{}}
  do_execsql_test func4-2.53 {
................................................................................
    }
  } {0 {}}
  do_test func4-3.18 {
    catchsql {
      INSERT INTO t1 (x) VALUES ('-9223372036854775809');
    }
  } {1 {constraint failed}}
  if {$highPrecision(1)} {
    do_test func4-3.19 {
      catchsql {
        INSERT INTO t1 (x) VALUES (9223372036854775808);
      }
    } {1 {constraint failed}}
  }
  do_execsql_test func4-3.20 {
    SELECT x FROM t1 ORDER BY x;
  } {1234 1234 1234}

  ifcapable floatingpoint {
    do_execsql_test func4-4.1 {
      CREATE TABLE t2(
................................................................................
  } {1}
  do_execsql_test func4-5.6 {
    SELECT tointeger(toreal(-9223372036854775808 - 1));
  } {-9223372036854775808}
  do_execsql_test func4-5.7 {
    SELECT tointeger(toreal(-9223372036854775808));
  } {-9223372036854775808}
  if {$highPrecision(2)} {
    do_execsql_test func4-5.8 {
      SELECT tointeger(toreal(-9223372036854775808 + 1));
    } {{}}
  }
  do_execsql_test func4-5.9 {
    SELECT tointeger(toreal(-2147483648 - 1));
  } {-2147483649}
................................................................................
  } {2147483647}
  do_execsql_test func4-5.14 {
    SELECT tointeger(toreal(2147483647 + 1));
  } {2147483648}
  do_execsql_test func4-5.15 {
    SELECT tointeger(toreal(9223372036854775807 - 1));
  } {{}}
  if {$highPrecision(1)} {
    do_execsql_test func4-5.16 {
      SELECT tointeger(toreal(9223372036854775807));
    } {{}}
    do_execsql_test func4-5.17 {
      SELECT tointeger(toreal(9223372036854775807 + 1));
    } {{}}
  }
  do_execsql_test func4-5.18 {
    SELECT tointeger(toreal(4503599627370496 - 1));
  } {4503599627370495}
  do_execsql_test func4-5.19 {
    SELECT tointeger(toreal(4503599627370496));
  } {4503599627370496}
  do_execsql_test func4-5.20 {
................................................................................
  } {4503599627370497}
  do_execsql_test func4-5.21 {
    SELECT tointeger(toreal(9007199254740992 - 1));
  } {9007199254740991}
  do_execsql_test func4-5.22 {
    SELECT tointeger(toreal(9007199254740992));
  } {9007199254740992}
  if {$highPrecision(2)} {
    do_execsql_test func4-5.23 {
      SELECT tointeger(toreal(9007199254740992 + 1));
    } {{}}
  }
  do_execsql_test func4-5.24 {
    SELECT tointeger(toreal(9007199254740992 + 2));
  } {9007199254740994}
  if {$highPrecision(1)} {
    do_execsql_test func4-5.25 {
      SELECT tointeger(toreal(9223372036854775808 - 1));
    } {{}}
    do_execsql_test func4-5.26 {
      SELECT tointeger(toreal(9223372036854775808));
    } {{}}
    do_execsql_test func4-5.27 {
      SELECT tointeger(toreal(9223372036854775808 + 1));
    } {{}}
  }
  do_execsql_test func4-5.28 {
    SELECT tointeger(toreal(18446744073709551616 - 1));
  } {{}}
  do_execsql_test func4-5.29 {
    SELECT tointeger(toreal(18446744073709551616));
  } {{}}
  do_execsql_test func4-5.30 {
    SELECT tointeger(toreal(18446744073709551616 + 1));
  } {{}}
}

for {set i 0} {$i < 10} {incr i} {
  if {$i == 8} continue
  do_execsql_test func4-6.1.$i.1 [subst {
    SELECT tointeger(x'[string repeat 01 $i]');
  }] {{}}
  ifcapable floatingpoint {
    do_execsql_test func4-6.1.$i.2 [subst {
      SELECT toreal(x'[string repeat 01 $i]');
    }] {{}}
  }
}

proc swapHexBytes { value } {
  if {[string length $value] % 2 != 0} {
    error "value \"$value\" must have an even number of characters"
  }
  if {![string is xdigit -strict $value]} then {
    error "value \"$value\" must contain only hexadecimal digits"
  }
  join [lreverse [regexp -all -inline {.{2}} $value]] ""
}

proc swapIntegerHexBytes { value } {
  if {![info exists ::tcl_platform(byteOrder)] || \
      $::tcl_platform(byteOrder) eq "littleEndian"} {
    return $value
  }
  return [swapHexBytes $value]
}

proc swapDoubleHexBytes { value } {
  if {![info exists ::tcl_platform(byteOrder)] || \
      $::tcl_platform(byteOrder) ne "littleEndian"} {
    return $value
  }
  return [swapHexBytes $value]
}

do_execsql_test func4-6.2.1 [subst {
  SELECT tointeger(x'[swapIntegerHexBytes 0102030405060708]');
}] {578437695752307201}
do_execsql_test func4-6.2.2 [subst {
  SELECT tointeger(x'[swapIntegerHexBytes 0807060504030201]');
}] {72623859790382856}

ifcapable floatingpoint {
  do_execsql_test func4-6.3.1 [subst {
    SELECT toreal(x'[swapDoubleHexBytes ffefffffffffffff]');
  }] {-1.7976931348623157e+308}
  do_execsql_test func4-6.3.2 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 8010000000000000]');
  }] {-2.2250738585072014e-308}
  do_execsql_test func4-6.3.3 [subst {
    SELECT toreal(x'[swapDoubleHexBytes c000000000000000]');
  }] {-2.0}
  do_execsql_test func4-6.3.4 [subst {
    SELECT toreal(x'[swapDoubleHexBytes bff0000000000000]');
  }] {-1.0}
  do_execsql_test func4-6.3.5 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 8000000000000000]');
  }] {-0.0}
  do_execsql_test func4-6.3.6 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 0000000000000000]');
  }] {0.0}
  do_execsql_test func4-6.3.7 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 3ff0000000000000]');
  }] {1.0}
  do_execsql_test func4-6.3.8 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 4000000000000000]');
  }] {2.0}
  do_execsql_test func4-6.3.9 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 0010000000000000]');
  }] {2.2250738585072014e-308}
  do_execsql_test func4-6.3.10 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 7fefffffffffffff]');
  }] {1.7976931348623157e+308}
  do_execsql_test func4-6.3.11 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 8000000000000001]');
  }] {-5e-324}
  do_execsql_test func4-6.3.12 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 800fffffffffffff]');
  }] {-2.225073858507201e-308}
  do_execsql_test func4-6.3.13 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 0000000000000001]');
  }] {5e-324}
  do_execsql_test func4-6.3.14 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 000fffffffffffff]');
  }] {2.225073858507201e-308}
  do_execsql_test func4-6.3.15 [subst {
    SELECT toreal(x'[swapDoubleHexBytes fff0000000000000]');
  }] {-Inf}
  do_execsql_test func4-6.3.16 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 7ff0000000000000]');
  }] {Inf}
  do_execsql_test func4-6.3.17 [subst {
    SELECT toreal(x'[swapDoubleHexBytes fff8000000000000]');
  }] {{}}
  do_execsql_test func4-6.3.18 [subst {
    SELECT toreal(x'[swapDoubleHexBytes fff0000000000001]');
  }] {{}}
  do_execsql_test func4-6.3.19 [subst {
    SELECT toreal(x'[swapDoubleHexBytes fff7ffffffffffff]');
  }] {{}}
  do_execsql_test func4-6.3.20 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 7ff0000000000001]');
  }] {{}}
  do_execsql_test func4-6.3.21 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 7ff7ffffffffffff]');
  }] {{}}
  do_execsql_test func4-6.3.22 [subst {
    SELECT toreal(x'[swapDoubleHexBytes fff8000000000001]');
  }] {{}}
  do_execsql_test func4-6.3.23 [subst {
    SELECT toreal(x'[swapDoubleHexBytes ffffffffffffffff]');
  }] {{}}
  do_execsql_test func4-6.3.24 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 7ff8000000000000]');
  }] {{}}
  do_execsql_test func4-6.3.25 [subst {
    SELECT toreal(x'[swapDoubleHexBytes 7fffffffffffffff]');
  }] {{}}
}

set tcl_precision $saved_tcl_precision
unset saved_tcl_precision
finish_test