1 #include this file into another for subclass testing
3 my $version = ${"$class\::VERSION"};
5 ##############################################################################
6 # for testing inheritance of _swap
10 use Math::BigInt lib => $main::CL;
12 @ISA = (qw/Math::BigInt/);
15 # customized overload for sub, since original does not use swap there
16 '-' => sub { my @a = ref($_[0])->_swap(@_);
21 # a fake _swap, which reverses the params
22 my $self = shift; # for override in subclass
25 my $c = ref ($_[0] ) || 'Math::Foo';
26 return ( $_[0]->copy(), $_[1] );
30 return ( Math::Foo->new($_[1]), $_[0] );
34 ##############################################################################
37 my $CALC = $class->config()->{lib}; ok ($CALC,$CL);
39 my ($f,$z,$a,$exp,@a,$m,$e,$round_mode,$expected_class);
44 next if /^#/; # skip comments
51 $round_mode = $_; $round_mode =~ s/^\$/$class\->/; next;
54 @args = split(/:/,$_,99); $ans = pop(@args);
55 $expected_class = $class;
56 if ($ans =~ /(.*?)=(.*)/)
58 $expected_class = $2; $ans = $1;
60 $try = "\$x = $class->new(\"$args[0]\");";
63 $try = "\$x = $class->bnorm(\"$args[0]\");";
65 } elsif ($f =~ /^is_(zero|one|odd|even|negative|positive|nan|int)$/) {
67 } elsif ($f eq "as_hex") {
68 $try .= '$x->as_hex();';
69 } elsif ($f eq "as_bin") {
70 $try .= '$x->as_bin();';
71 } elsif ($f eq "is_inf") {
72 $try .= "\$x->is_inf('$args[1]');";
73 } elsif ($f eq "binf") {
74 $try .= "\$x->binf('$args[1]');";
75 } elsif ($f eq "bone") {
76 $try .= "\$x->bone('$args[1]');";
78 } elsif ($f =~ /^b(nan|floor|ceil|sstr|neg|abs|inc|dec|not|sqrt|fac)$/) {
80 } elsif ($f eq "length") {
81 $try .= '$x->length();';
82 } elsif ($f eq "exponent"){
83 # ->bstr() to see if an object is returned
84 $try .= '$x = $x->exponent()->bstr();';
85 } elsif ($f eq "mantissa"){
86 # ->bstr() to see if an object is returned
87 $try .= '$x = $x->mantissa()->bstr();';
88 } elsif ($f eq "parts"){
89 $try .= '($m,$e) = $x->parts();';
90 # ->bstr() to see if an object is returned
91 $try .= '$m = $m->bstr(); $m = "NaN" if !defined $m;';
92 $try .= '$e = $e->bstr(); $e = "NaN" if !defined $e;';
95 $try .= "\$y = $class->new('$args[1]');";
99 } elsif ($f eq "bround") {
100 $try .= "$round_mode; \$x->bround(\$y);";
101 } elsif ($f eq "bacmp"){
102 $try .= '$x->bacmp($y);';
103 } elsif ($f eq "badd"){
105 } elsif ($f eq "bsub"){
107 } elsif ($f eq "bmul"){
109 } elsif ($f eq "bdiv"){
111 } elsif ($f eq "bdiv-list"){
112 $try .= 'join (",",$x->bdiv($y));';
114 } elsif ($f =~ /^.=$/){
115 $try .= "\$x $f \$y;";
117 } elsif ($f =~ /^.$/){
118 $try .= "\$x $f \$y;";
119 } elsif ($f eq "bmod"){
121 } elsif ($f eq "bgcd")
123 if (defined $args[2])
125 $try .= " \$z = $class->new('$args[2]'); ";
127 $try .= "$class\::bgcd(\$x, \$y";
128 $try .= ", \$z" if (defined $args[2]);
133 if (defined $args[2])
135 $try .= " \$z = $class->new('$args[2]'); ";
137 $try .= "$class\::blcm(\$x, \$y";
138 $try .= ", \$z" if (defined $args[2]);
140 }elsif ($f eq "blsft"){
141 if (defined $args[2])
143 $try .= "\$x->blsft(\$y,$args[2]);";
147 $try .= "\$x << \$y;";
149 }elsif ($f eq "brsft"){
150 if (defined $args[2])
152 $try .= "\$x->brsft(\$y,$args[2]);";
156 $try .= "\$x >> \$y;";
158 }elsif ($f eq "band"){
159 $try .= "\$x & \$y;";
160 }elsif ($f eq "bior"){
161 $try .= "\$x | \$y;";
162 }elsif ($f eq "bxor"){
163 $try .= "\$x ^ \$y;";
164 }elsif ($f eq "bpow"){
165 $try .= "\$x ** \$y;";
166 }elsif ($f eq "digit"){
167 $try = "\$x = $class->new('$args[0]'); \$x->digit($args[1]);";
168 } else { warn "Unknown op '$f'"; }
169 } # end else all other ops
172 # convert hex/binary targets to decimal
173 if ($ans =~ /^(0x0x|0b0b)/)
175 $ans =~ s/^0[xb]//; $ans = Math::BigInt->new($ans)->bstr();
183 # print "try: $try ans: $ans1 $ans\n";
184 print "# Tried: '$try'\n" if !ok ($ans1, $ans);
185 ok (ref($ans),$expected_class) if $expected_class ne $class;
187 # check internal state of number objects
188 is_valid($ans1,$f) if ref $ans1;
189 } # endwhile data tests
194 for (my $i = 1; $i < 10; $i++)
198 ok "@a", "1 2 3 4 5 6 7 8 9";
200 # test whether self-multiplication works correctly (result is 2**64)
201 $try = "\$x = $class->new('4294967296');";
202 $try .= '$a = $x->bmul($x);';
204 print "# Tried: '$try'\n" if !ok ($ans1, $class->new(2) ** 64);
206 $try = "\$x = $class->new(10);";
207 $try .= '$a = $x->bpow($x);';
209 print "# Tried: '$try'\n" if !ok ($ans1, $class->new(10) ** 10);
211 # test whether op destroys args or not (should better not)
237 $x = $class->new(-5); $y = -$x;
240 $x = $class->new(-5); $y = abs($x);
243 # check whether overloading cmp works
244 $try = "\$x = $class->new(0);";
246 $try .= "'false' if \$x ne \$y;";
248 print "# For '$try'\n" if (!ok "$ans" , "false" );
250 # we cant test for working cmpt with other objects here, we would need a dummy
251 # object with stringify overload for this. see Math::String tests as example
253 ###############################################################################
254 # check reversed order of arguments
256 $try = "\$x = $class->new(10); \$x = 2 ** \$x;";
257 $try .= "'ok' if \$x == 1024;"; $ans = eval $try;
258 print "# For '$try'\n" if (!ok "$ans" , "ok" );
260 $try = "\$x = $class->new(10); \$x = 2 * \$x;";
261 $try .= "'ok' if \$x == 20;"; $ans = eval $try;
262 print "# For '$try'\n" if (!ok "$ans" , "ok" );
264 $try = "\$x = $class->new(10); \$x = 2 + \$x;";
265 $try .= "'ok' if \$x == 12;"; $ans = eval $try;
266 print "# For '$try'\n" if (!ok "$ans" , "ok" );
268 $try = "\$x = $class\->new(10); \$x = 2 - \$x;";
269 $try .= "'ok' if \$x == -8;"; $ans = eval $try;
270 print "# For '$try'\n" if (!ok "$ans" , "ok" );
272 $try = "\$x = $class\->new(10); \$x = 20 / \$x;";
273 $try .= "'ok' if \$x == 2;"; $ans = eval $try;
274 print "# For '$try'\n" if (!ok "$ans" , "ok" );
276 $try = "\$x = $class\->new(3); \$x = 20 % \$x;";
277 $try .= "'ok' if \$x == 2;"; $ans = eval $try;
278 print "# For '$try'\n" if (!ok "$ans" , "ok" );
280 $try = "\$x = $class\->new(7); \$x = 20 & \$x;";
281 $try .= "'ok' if \$x == 4;"; $ans = eval $try;
282 print "# For '$try'\n" if (!ok "$ans" , "ok" );
284 $try = "\$x = $class\->new(7); \$x = 0x20 | \$x;";
285 $try .= "'ok' if \$x == 0x27;"; $ans = eval $try;
286 print "# For '$try'\n" if (!ok "$ans" , "ok" );
288 $try = "\$x = $class\->new(7); \$x = 0x20 ^ \$x;";
289 $try .= "'ok' if \$x == 0x27;"; $ans = eval $try;
290 print "# For '$try'\n" if (!ok "$ans" , "ok" );
292 ###############################################################################
293 # check badd(4,5) form
295 $try = "\$x = $class\->badd(4,5);";
296 $try .= "'ok' if \$x == 9;";
298 print "# For '$try'\n" if (!ok "$ans" , "ok" );
300 ###############################################################################
301 # check undefs: NOT DONE YET
303 ###############################################################################
306 $x = Math::BigInt->new(1); if ($x) { ok (1,1); } else { ok($x,'to be true') }
307 $x = Math::BigInt->new(0); if (!$x) { ok (1,1); } else { ok($x,'to be false') }
309 ###############################################################################
312 @args = Math::BigInt::objectify(2,4,5);
313 ok (scalar @args,3); # $class, 4, 5
314 ok ($args[0],$class);
318 @args = Math::BigInt::objectify(0,4,5);
319 ok (scalar @args,3); # $class, 4, 5
320 ok ($args[0],$class);
324 @args = Math::BigInt::objectify(2,4,5);
325 ok (scalar @args,3); # $class, 4, 5
326 ok ($args[0],$class);
330 @args = Math::BigInt::objectify(2,4,5,6,7);
331 ok (scalar @args,5); # $class, 4, 5, 6, 7
332 ok ($args[0],$class);
333 ok ($args[1],4); ok (ref($args[1]),$args[0]);
334 ok ($args[2],5); ok (ref($args[2]),$args[0]);
335 ok ($args[3],6); ok (ref($args[3]),'');
336 ok ($args[4],7); ok (ref($args[4]),'');
338 @args = Math::BigInt::objectify(2,$class,4,5,6,7);
339 ok (scalar @args,5); # $class, 4, 5, 6, 7
340 ok ($args[0],$class);
341 ok ($args[1],4); ok (ref($args[1]),$args[0]);
342 ok ($args[2],5); ok (ref($args[2]),$args[0]);
343 ok ($args[3],6); ok (ref($args[3]),'');
344 ok ($args[4],7); ok (ref($args[4]),'');
346 ###############################################################################
347 # test for floating-point input (other tests in bnorm() below)
349 $z = 1050000000000000; # may be int on systems with 64bit?
350 $x = $class->new($z); ok ($x->bsstr(),'105e+13'); # not 1.05e+15
351 $z = 1e+129; # definitely a float (may fail on UTS)
352 # don't compare to $z, since some Perl versions stringify $z into something
353 # like '1.e+129' or something equally ugly
354 $x = $class->new($z); ok ($x->bsstr(),'1e+129');
356 ###############################################################################
357 # prime number tests, also test for **= and length()
358 # found on: http://www.utm.edu/research/primes/notes/by_year.html
361 $x = $class->new(2); $x **= 148; $x++; $x = $x / 17;
362 ok ($x,"20988936657440586486151264256610222593863921");
363 ok ($x->length(),length "20988936657440586486151264256610222593863921");
366 $x = $class->new(2); $x **= 127; $x--;
367 ok ($x,"170141183460469231731687303715884105727");
369 $x = $class->new('215960156869840440586892398248');
370 ($x,$y) = $x->length();
371 ok ($x,30); ok ($y,0);
373 $x = $class->new('1_000_000_000_000');
374 ($x,$y) = $x->length();
375 ok ($x,13); ok ($y,0);
377 # I am afraid the following is not yet possible due to slowness
378 # Also, testing for 2 meg output is a bit hard ;)
379 #$x = $class->new(2); $x **= 6972593; $x--;
381 # 593573509*2^332162+1 has exactly 1,000,000 digits
382 # takes about 24 mins on 300 Mhz, so cannot be done yet ;)
383 #$x = $class->new(2); $x **= 332162; $x *= "593573509"; $x++;
384 #ok ($x->length(),1_000_000);
386 ###############################################################################
387 # inheritance and overriding of _swap
389 $x = Math::Foo->new(5);
390 $x = $x - 8; # 8 - 5 instead of 5-8
392 ok (ref($x),'Math::Foo');
394 $x = Math::Foo->new(5);
395 $x = 8 - $x; # 5 - 8 instead of 8 - 5
397 ok (ref($x),'Math::Foo');
399 ###############################################################################
400 # Test whether +inf eq inf
401 # This tried to test whether BigInt inf equals Perl inf. Unfortunately, Perl
402 # hasn't (before 5.7.3 at least) a consistent way to say inf, and some things
403 # like 1e100000 crash on some platforms. So simple test for the string 'inf'
404 $x = $class->new('+inf'); ok ($x,'inf');
406 ###############################################################################
407 ###############################################################################
408 # the followin tests only make sense with Math::BigInt::Calc or BareCalc
410 exit if $CALC !~ /^Math::BigInt::(Calc|BareCalc)$/; # for Pari et al.
412 ###############################################################################
413 # check proper length of internal arrays
415 my $bl = $CL->_base_len();
416 my $BASE = '9' x $bl;
420 $x = $class->new($MAX); is_valid($x); # f.i. 9999
421 $x += 1; ok ($x,$BASE); is_valid($x); # 10000
422 $x -= 1; ok ($x,$MAX); is_valid($x); # 9999 again
424 ###############################################################################
427 $x = $class->new($BASE-1); ok ($x->numify(),$BASE-1);
428 $x = $class->new(-($BASE-1)); ok ($x->numify(),-($BASE-1));
430 # +0 is to protect from 1e15 vs 100000000 (stupid to_string aaaarglburblll...)
431 $x = $class->new($BASE); ok ($x->numify()+0,$BASE+0);
432 $x = $class->new(-$BASE); ok ($x->numify(),-$BASE);
433 $x = $class->new( -($BASE*$BASE*1+$BASE*1+1) );
434 ok($x->numify(),-($BASE*$BASE*1+$BASE*1+1));
436 ###############################################################################
437 # test bug in _digits with length($c[-1]) where $c[-1] was "00001" instead of 1
439 $x = $class->new($BASE-2); $x++; $x++; $x++; $x++;
440 if ($x > $BASE) { ok (1,1) } else { ok ("$x < $BASE","$x > $BASE"); }
442 $x = $class->new($BASE+3); $x++;
443 if ($x > $BASE) { ok (1,1) } else { ok ("$x > $BASE","$x < $BASE"); }
445 # test for +0 instead of int():
446 $x = $class->new($MAX); ok ($x->length(), length($MAX));
448 ###############################################################################
449 # bug in sub where number with at least 6 trailing zeros after any op failed
451 $x = $class->new(123456); $z = $class->new(10000); $z *= 10; $x -= $z;
455 ###############################################################################
456 # bug in shortcut in mul()
458 # construct a number with a zero-hole of BASE_LEN_SMALL
460 my @bl = $CL->_base_len(); my $bl = $bl[4];
462 $x = '1' x $bl . '0' x $bl . '1' x $bl . '0' x $bl;
464 $x = $class->new($x)->bmul($y);
465 # result is 123..$bl . $bl x (3*bl-1) . $bl...321 . '0' x $bl
467 for (my $i = 1; $i <= $bl; $i++)
469 $y .= $i; $d = $i.$d;
471 $y .= $bl x (3*$bl-1) . $d . '0' x $bl;
475 ###############################################################################
476 # see if mul shortcut for small numbers works
479 $x = $class->new($x);
480 # 999 * 999 => 998 . 001, 9999*9999 => 9998 . 0001
481 ok ($x*$x, '9' x ($bl-1) . '8' . '0' x ($bl-1) . '1');
485 ###############################################################################
486 # bug with rest "-0" in div, causing further div()s to fail
488 $x = $class->new('-322056000'); ($x,$y) = $x->bdiv('-12882240');
490 ok ($y,'0'); is_valid($y); # $y not '-0'
496 ###############################################################################
497 ###############################################################################
498 # Perl 5.005 does not like ok ($x,undef)
504 ok (1,1) and return if !defined $x;
508 ###############################################################################
509 # sub to check validity of a BigInt internally, to ensure that no op leaves a
510 # number object in an invalid state (f.i. "-0")
518 $e = 'Not a reference to Math::BigInt' if !ref($x);
521 $e = "Illegal sign $x->{sign} (expected: '+', '-', '-inf', '+inf' or 'NaN'"
522 if $e eq '0' && $x->{sign} !~ /^(\+|-|\+inf|-inf|NaN)$/;
524 $e = "-0 is invalid!" if $e ne '0' && $x->{sign} eq '-' && $x == 0;
525 $e = $CALC->_check($x->{value}) if $e eq '0';
527 # test done, see if error did crop up
528 ok (1,1), return if ($e eq '0');
530 ok (1,$e." after op '$f'");
609 -123456789:+987654321:-1
610 +123456789:-987654321:-1
611 +987654321:+123456789:1
612 -987654321:+123456789:1
654 0b10000000000001:8193
655 0b100000000000001:16385
656 0b1000000000000001:32769
657 0b10000000000000001:65537
658 0b100000000000000001:131073
659 0b1000000000000000001:262145
660 0b10000000000000000001:524289
661 0b100000000000000000001:1048577
662 0b1000000000000000000001:2097153
663 0b10000000000000000000001:4194305
664 0b100000000000000000000001:8388609
665 0b1000000000000000000000001:16777217
666 0b10000000000000000000000001:33554433
667 0b100000000000000000000000001:67108865
668 0b1000000000000000000000000001:134217729
669 0b10000000000000000000000000001:268435457
670 0b100000000000000000000000000001:536870913
671 0b1000000000000000000000000000001:1073741825
672 0b10000000000000000000000000000001:2147483649
673 0b100000000000000000000000000000001:4294967297
674 0b1000000000000000000000000000000001:8589934593
675 0b10000000000000000000000000000000001:17179869185
687 0x1_2_3_4_56_78:305419896
688 0xa_b_c_d_e_f:11259375
717 0x40000001:1073741825
718 0x80000001:2147483649
719 0x100000001:4294967297
720 0x200000001:8589934593
721 0x400000001:17179869185
722 0x800000001:34359738369
736 # only one underscore between two digits
754 # bug with two E's in number beeing valid
767 01234567891:1234567891
768 012345678912:12345678912
769 0123456789123:123456789123
770 01234567891234:1234567891234
787 -123456789:-123456789
796 # floating point input
804 # non-integer numbers
839 # it must be exactly /^[+-]inf$/
846 +1:+48:281474976710656
849 +12345:4:10:123450000
855 1234567890123:12:10:1234567890123000000000000
859 -102533203:1:2:-205066406
864 +281474976710656:+48:1
875 1230000000000:10:10:123
876 09876123456789067890:12:10:9876123
877 1234561234567890123:13:10:123456
878 820265627:1:2:410132813
879 # test shifting negative numbers in base 2
895 -1640531254:2:2:-410132814
896 -1640531254:1:2:-820265627
897 -820265627:1:2:-410132814
898 -205066405:1:2:-102533203
912 +123456789:-123456789
947 -123456789:987654321:-1
948 +123456789:-987654321:1
949 -987654321:123456789:-1
1008 +9999999:+1:10000000
1009 +99999999:+1:100000000
1010 +999999999:+1:1000000000
1011 +9999999999:+1:10000000000
1012 +99999999999:+1:100000000000
1019 +10000000:-1:9999999
1020 +100000000:-1:99999999
1021 +1000000000:-1:999999999
1022 +10000000000:-1:9999999999
1023 +123456789:987654321:1111111110
1024 -123456789:987654321:864197532
1025 -123456789:-987654321:-1111111110
1026 +123456789:-987654321:-864197532
1051 +99999999:+1:99999998
1052 +999999999:+1:999999998
1053 +9999999999:+1:9999999998
1054 +99999999999:+1:99999999998
1061 +10000000:-1:10000001
1062 +100000000:-1:100000001
1063 +1000000000:-1:1000000001
1064 +10000000000:-1:10000000001
1065 +123456789:+987654321:-864197532
1066 -123456789:+987654321:-1111111110
1067 -123456789:-987654321:864197532
1068 +123456789:-987654321:1111111110
1086 123456789123456789:0:0
1087 0:123456789123456789:0
1097 10101:10101:102030201
1098 1001001:1001001:1002003002001
1099 100010001:100010001:10002000300020001
1100 10000100001:10000100001:100002000030000200001
1101 11111111111:9:99999999999
1102 22222222222:9:199999999998
1103 33333333333:9:299999999997
1104 44444444444:9:399999999996
1105 55555555555:9:499999999995
1106 66666666666:9:599999999994
1107 77777777777:9:699999999993
1108 88888888888:9:799999999992
1109 99999999999:9:899999999991
1111 +12345:+12345:152399025
1112 +99999:+11111:1111088889
1114 99999:100000:9999900000
1115 999999:1000000:999999000000
1116 9999999:10000000:99999990000000
1117 99999999:100000000:9999999900000000
1118 999999999:1000000000:999999999000000000
1119 9999999999:10000000000:99999999990000000000
1120 99999999999:100000000000:9999999999900000000000
1121 999999999999:1000000000000:999999999999000000000000
1122 9999999999999:10000000000000:99999999999990000000000000
1123 99999999999999:100000000000000:9999999999999900000000000000
1124 999999999999999:1000000000000000:999999999999999000000000000000
1125 9999999999999999:10000000000000000:99999999999999990000000000000000
1126 99999999999999999:100000000000000000:9999999999999999900000000000000000
1127 999999999999999999:1000000000000000000:999999999999999999000000000000000000
1128 9999999999999999999:10000000000000000000:99999999999999999990000000000000000000
1138 # inf handling and general remainder
1144 # see table in documentation in MBI
1163 # exceptions to reminder rule
1172 # inf handling (see table in doc)
1207 1000000000:9:111111111
1208 2000000000:9:222222222
1209 3000000000:9:333333333
1210 4000000000:9:444444444
1211 5000000000:9:555555555
1212 6000000000:9:666666666
1213 7000000000:9:777777777
1214 8000000000:9:888888888
1215 9000000000:9:1000000000
1218 106500000:339:314159
1219 1000000000:3:333333333
1224 999999999999:9:111111111111
1225 999999999999:99:10101010101
1226 999999999999:999:1001001001
1227 999999999999:9999:100010001
1228 999999999999999:99999:10000100001
1229 +1111088889:99999:11111
1244 # bug in Calc with '99999' vs $BASE-1
1245 10000000000000000000000000000000000000000000000000000000000000000000000000000000000:10000000375084540248994272022843165711074:999999962491547381984643365663244474111576
1247 # inf handling, see table in doc
1266 # exceptions to reminder rule
1305 999999999999999:99999:0
1319 152403346:12345:4321
1353 +281474976710656:0:0
1354 +281474976710656:1:0
1355 +281474976710656:+281474976710656:281474976710656
1362 # equal arguments are treated special, so also do some test with unequal ones
1363 0xFFFF:0xFFFF:0x0xFFFF
1364 0xFFFFFF:0xFFFFFF:0x0xFFFFFF
1365 0xFFFFFFFF:0xFFFFFFFF:0x0xFFFFFFFF
1366 0xFFFFFFFFFF:0xFFFFFFFFFF:0x0xFFFFFFFFFF
1367 0xFFFFFFFFFFFF:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
1368 0xF0F0:0xF0F0:0x0xF0F0
1369 0x0F0F:0x0F0F:0x0x0F0F
1370 0xF0F0F0:0xF0F0F0:0x0xF0F0F0
1371 0x0F0F0F:0x0F0F0F:0x0x0F0F0F
1372 0xF0F0F0F0:0xF0F0F0F0:0x0xF0F0F0F0
1373 0x0F0F0F0F:0x0F0F0F0F:0x0x0F0F0F0F
1374 0xF0F0F0F0F0:0xF0F0F0F0F0:0x0xF0F0F0F0F0
1375 0x0F0F0F0F0F:0x0F0F0F0F0F:0x0x0F0F0F0F0F
1376 0xF0F0F0F0F0F0:0xF0F0F0F0F0F0:0x0xF0F0F0F0F0F0
1377 0x0F0F0F0F0F0F:0x0F0F0F0F0F0F:0x0x0F0F0F0F0F0F
1378 0x1F0F0F0F0F0F:0x3F0F0F0F0F0F:0x0x1F0F0F0F0F0F
1385 +281474976710656:0:281474976710656
1386 +281474976710656:1:281474976710657
1387 +281474976710656:281474976710656:281474976710656
1393 # equal arguments are treated special, so also do some test with unequal ones
1394 0xFFFF:0xFFFF:0x0xFFFF
1395 0xFFFFFF:0xFFFFFF:0x0xFFFFFF
1396 0xFFFFFFFF:0xFFFFFFFF:0x0xFFFFFFFF
1397 0xFFFFFFFFFF:0xFFFFFFFFFF:0x0xFFFFFFFFFF
1398 0xFFFFFFFFFFFF:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
1400 0:0xFFFFFF:0x0xFFFFFF
1401 0:0xFFFFFFFF:0x0xFFFFFFFF
1402 0:0xFFFFFFFFFF:0x0xFFFFFFFFFF
1403 0:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
1405 0xFFFFFF:0:0x0xFFFFFF
1406 0xFFFFFFFF:0:0x0xFFFFFFFF
1407 0xFFFFFFFFFF:0:0x0xFFFFFFFFFF
1408 0xFFFFFFFFFFFF:0:0x0xFFFFFFFFFFFF
1409 0xF0F0:0xF0F0:0x0xF0F0
1410 0x0F0F:0x0F0F:0x0x0F0F
1411 0xF0F0:0x0F0F:0x0xFFFF
1412 0xF0F0F0:0xF0F0F0:0x0xF0F0F0
1413 0x0F0F0F:0x0F0F0F:0x0x0F0F0F
1414 0x0F0F0F:0xF0F0F0:0x0xFFFFFF
1415 0xF0F0F0F0:0xF0F0F0F0:0x0xF0F0F0F0
1416 0x0F0F0F0F:0x0F0F0F0F:0x0x0F0F0F0F
1417 0x0F0F0F0F:0xF0F0F0F0:0x0xFFFFFFFF
1418 0xF0F0F0F0F0:0xF0F0F0F0F0:0x0xF0F0F0F0F0
1419 0x0F0F0F0F0F:0x0F0F0F0F0F:0x0x0F0F0F0F0F
1420 0x0F0F0F0F0F:0xF0F0F0F0F0:0x0xFFFFFFFFFF
1421 0xF0F0F0F0F0F0:0xF0F0F0F0F0F0:0x0xF0F0F0F0F0F0
1422 0x0F0F0F0F0F0F:0x0F0F0F0F0F0F:0x0x0F0F0F0F0F0F
1423 0x0F0F0F0F0F0F:0xF0F0F0F0F0F0:0x0xFFFFFFFFFFFF
1424 0x1F0F0F0F0F0F:0xF0F0F0F0F0F0:0x0xFFFFFFFFFFFF
1431 +281474976710656:0:281474976710656
1432 +281474976710656:1:281474976710657
1433 +281474976710656:281474976710656:0
1441 # equal arguments are treated special, so also do some test with unequal ones
1444 0xFFFFFFFF:0xFFFFFFFF:0
1445 0xFFFFFFFFFF:0xFFFFFFFFFF:0
1446 0xFFFFFFFFFFFF:0xFFFFFFFFFFFF:0
1448 0:0xFFFFFF:0x0xFFFFFF
1449 0:0xFFFFFFFF:0x0xFFFFFFFF
1450 0:0xFFFFFFFFFF:0x0xFFFFFFFFFF
1451 0:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
1453 0xFFFFFF:0:0x0xFFFFFF
1454 0xFFFFFFFF:0:0x0xFFFFFFFF
1455 0xFFFFFFFFFF:0:0x0xFFFFFFFFFF
1456 0xFFFFFFFFFFFF:0:0x0xFFFFFFFFFFFF
1459 0xF0F0:0x0F0F:0x0xFFFF
1462 0x0F0F0F:0xF0F0F0:0x0xFFFFFF
1463 0xF0F0F0F0:0xF0F0F0F0:0
1464 0x0F0F0F0F:0x0F0F0F0F:0
1465 0x0F0F0F0F:0xF0F0F0F0:0x0xFFFFFFFF
1466 0xF0F0F0F0F0:0xF0F0F0F0F0:0
1467 0x0F0F0F0F0F:0x0F0F0F0F0F:0
1468 0x0F0F0F0F0F:0xF0F0F0F0F0:0x0xFFFFFFFFFF
1469 0xF0F0F0F0F0F0:0xF0F0F0F0F0F0:0
1470 0x0F0F0F0F0F0F:0x0F0F0F0F0F0F:0
1471 0x0F0F0F0F0F0F:0xF0F0F0F0F0F0:0x0xFFFFFFFFFFFF
1476 +281474976710656:-281474976710657
1571 -inf:1234500012:-inf
1572 +inf:-12345000123:inf
1573 -inf:-12345000123:-inf
1574 # 1 ** -x => 1 / (1 ** x)
1594 10:20:100000000000000000000
1595 123456:2:15241383936
1602 10000000000000000:17
1604 215960156869840440586892398248:30
1620 4000000000000:2000000
1631 $round_mode('trunc')
1641 +10123456789:5:10123000000
1642 -10123456789:5:-10123000000
1643 +10123456789:9:10123456700
1644 -10123456789:9:-10123456700
1645 +101234500:6:101234000
1646 -101234500:6:-101234000
1647 #+101234500:-4:101234000
1648 #-101234500:-4:-101234000
1650 +20123456789:5:20123000000
1651 -20123456789:5:-20123000000
1652 +20123456789:9:20123456800
1653 -20123456789:9:-20123456800
1654 +201234500:6:201234000
1655 -201234500:6:-201234000
1656 #+201234500:-4:201234000
1657 #-201234500:-4:-201234000
1658 +12345000:4:12340000
1659 -12345000:4:-12340000
1661 +30123456789:5:30123000000
1662 -30123456789:5:-30123000000
1663 +30123456789:9:30123456800
1664 -30123456789:9:-30123456800
1665 +301234500:6:301235000
1666 -301234500:6:-301234000
1667 #+301234500:-4:301235000
1668 #-301234500:-4:-301234000
1669 +12345000:4:12350000
1670 -12345000:4:-12340000
1672 +40123456789:5:40123000000
1673 -40123456789:5:-40123000000
1674 +40123456789:9:40123456800
1675 -40123456789:9:-40123456800
1676 +401234500:6:401234000
1677 +401234500:6:401234000
1678 #-401234500:-4:-401235000
1679 #-401234500:-4:-401235000
1680 +12345000:4:12340000
1681 -12345000:4:-12350000
1683 +50123456789:5:50123000000
1684 -50123456789:5:-50123000000
1685 +50123456789:9:50123456800
1686 -50123456789:9:-50123456800
1687 +501234500:6:501235000
1688 -501234500:6:-501235000
1689 #+501234500:-4:501235000
1690 #-501234500:-4:-501235000
1691 +12345000:4:12350000
1692 -12345000:4:-12350000
1694 +60123456789:5:60123000000
1695 -60123456789:5:-60123000000
1696 +60123456789:9:60123456800
1697 -60123456789:9:-60123456800
1698 +601234500:6:601234000
1699 -601234500:6:-601234000
1700 #+601234500:-4:601234000
1701 #-601234500:-4:-601234000
1708 +12345000:4:12340000
1709 -12345000:4:-12340000
1727 # floor and ceil tests are pretty pointless in integer space...but play safe
1754 0x123456789123456789:0x123456789123456789
1764 0b1010111101010101010110110110110110101:0b1010111101010101010110110110110110101