1 #include this file into another for subclass testing
3 my $version = ${"$class\::VERSION"};
5 ##############################################################################
6 # for testing inheritance of _swap
11 #use Math::BigInt lib => 'BitVect'; # for testing
13 @ISA = (qw/Math::BigInt/);
16 # customized overload for sub, since original does not use swap there
17 '-' => sub { my @a = ref($_[0])->_swap(@_);
22 # a fake _swap, which reverses the params
23 my $self = shift; # for override in subclass
26 my $c = ref ($_[0] ) || 'Math::Foo';
27 return ( $_[0]->copy(), $_[1] );
31 return ( Math::Foo->new($_[1]), $_[0] );
35 ##############################################################################
38 my $CALC = $class->_core_lib(); ok ($CALC,$CL);
40 my ($f,$z,$a,$exp,@a,$m,$e,$round_mode);
45 next if /^#/; # skip comments
53 $round_mode =~ s/^\$/$class\->/;
54 # print "$round_mode\n";
58 @args = split(/:/,$_,99);
60 $try = "\$x = $class->new(\"$args[0]\");";
62 $try = "\$x = $class->bnorm(\"$args[0]\");";
64 } elsif ($f =~ /^is_(zero|one|odd|even|negative|positive|nan)$/) {
66 } elsif ($f eq "as_hex") {
67 $try .= '$x->as_hex();';
68 } elsif ($f eq "as_bin") {
69 $try .= '$x->as_bin();';
70 } elsif ($f eq "is_inf") {
71 $try .= "\$x->is_inf('$args[1]');";
72 } elsif ($f eq "binf") {
73 $try .= "\$x->binf('$args[1]');";
74 } elsif ($f eq "bone") {
75 $try .= "\$x->bone('$args[1]');";
77 } elsif ($f =~ /^b(nan|floor|ceil|sstr|neg|abs|inc|dec|not|sqrt)$/) {
79 }elsif ($f eq "length") {
80 $try .= '$x->length();';
81 }elsif ($f eq "exponent"){
82 # ->bstr() to see if an object is returned
83 $try .= '$x = $x->exponent()->bstr();';
84 }elsif ($f eq "mantissa"){
85 # ->bstr() to see if an object is returned
86 $try .= '$x = $x->mantissa()->bstr();';
87 }elsif ($f eq "parts"){
88 $try .= '($m,$e) = $x->parts();';
89 # ->bstr() to see if an object is returned
90 $try .= '$m = $m->bstr(); $m = "NaN" if !defined $m;';
91 $try .= '$e = $e->bstr(); $e = "NaN" if !defined $e;';
94 $try .= "\$y = $class->new('$args[1]');";
97 }elsif ($f eq "bround") {
98 $try .= "$round_mode; \$x->bround(\$y);";
99 }elsif ($f eq "bacmp"){
100 $try .= '$x->bacmp($y);';
101 }elsif ($f eq "badd"){
103 }elsif ($f eq "bsub"){
105 }elsif ($f eq "bmul"){
107 }elsif ($f eq "bdiv"){
109 }elsif ($f eq "bdiv-list"){
110 $try .= 'join (",",$x->bdiv($y));';
112 }elsif ($f =~ /^.=$/){
113 $try .= "\$x $f \$y;";
115 }elsif ($f =~ /^.$/){
116 $try .= "\$x $f \$y;";
117 }elsif ($f eq "bmod"){
119 }elsif ($f eq "bgcd")
121 if (defined $args[2])
123 $try .= " \$z = $class->new(\"$args[2]\"); ";
125 $try .= "$class\::bgcd(\$x, \$y";
126 $try .= ", \$z" if (defined $args[2]);
131 if (defined $args[2])
133 $try .= " \$z = $class->new(\"$args[2]\"); ";
135 $try .= "$class\::blcm(\$x, \$y";
136 $try .= ", \$z" if (defined $args[2]);
138 }elsif ($f eq "blsft"){
139 if (defined $args[2])
141 $try .= "\$x->blsft(\$y,$args[2]);";
145 $try .= "\$x << \$y;";
147 }elsif ($f eq "brsft"){
148 if (defined $args[2])
150 $try .= "\$x->brsft(\$y,$args[2]);";
154 $try .= "\$x >> \$y;";
156 }elsif ($f eq "band"){
157 $try .= "\$x & \$y;";
158 }elsif ($f eq "bior"){
159 $try .= "\$x | \$y;";
160 }elsif ($f eq "bxor"){
161 $try .= "\$x ^ \$y;";
162 }elsif ($f eq "bpow"){
163 $try .= "\$x ** \$y;";
164 }elsif ($f eq "digit"){
165 $try = "\$x = $class->new(\"$args[0]\"); \$x->digit($args[1]);";
166 } else { warn "Unknown op '$f'"; }
168 # print "trying $try\n";
170 # remove leading '+' from target
171 $ans =~ s/^[+]([0-9])/$1/;
172 # convert hex/binary targets to decimal
173 if ($ans =~ /^(0x0x|0b0b)/)
176 $ans = Math::BigInt->new($ans)->bstr();
184 # print "try: $try ans: $ans1 $ans\n";
185 print "# Tried: '$try'\n" if !ok ($ans1, $ans);
187 # check internal state of number objects
188 is_valid($ans1,$f) if ref $ans1;
190 } # endwhile data tests
195 for (my $i = 1; $i < 10; $i++)
199 ok "@a", "1 2 3 4 5 6 7 8 9";
201 # test whether self-multiplication works correctly (result is 2**64)
202 $try = "\$x = $class->new('4294967296');";
203 $try .= '$a = $x->bmul($x);';
205 print "# Tried: '$try'\n" if !ok ($ans1, $class->new(2) ** 64);
207 $try = "\$x = $class->new(10);";
208 $try .= '$a = $x->bpow($x);';
210 print "# Tried: '$try'\n" if !ok ($ans1, $class->new(10) ** 10);
212 # test whether op destroys args or not (should better not)
238 $x = $class->new(-5); $y = -$x;
241 $x = $class->new(-5); $y = abs($x);
244 # check whether overloading cmp works
245 $try = "\$x = $class->new(0);";
247 $try .= "'false' if \$x ne \$y;";
249 print "# For '$try'\n" if (!ok "$ans" , "false" );
251 # we cant test for working cmpt with other objects here, we would need a dummy
252 # object with stringify overload for this. see Math::String tests as example
254 ###############################################################################
255 # check reversed order of arguments
257 $try = "\$x = $class->new(10); \$x = 2 ** \$x;";
258 $try .= "'ok' if \$x == 1024;"; $ans = eval $try;
259 print "# For '$try'\n" if (!ok "$ans" , "ok" );
261 $try = "\$x = $class->new(10); \$x = 2 * \$x;";
262 $try .= "'ok' if \$x == 20;"; $ans = eval $try;
263 print "# For '$try'\n" if (!ok "$ans" , "ok" );
265 $try = "\$x = $class->new(10); \$x = 2 + \$x;";
266 $try .= "'ok' if \$x == 12;"; $ans = eval $try;
267 print "# For '$try'\n" if (!ok "$ans" , "ok" );
269 $try = "\$x = $class\->new(10); \$x = 2 - \$x;";
270 $try .= "'ok' if \$x == -8;"; $ans = eval $try;
271 print "# For '$try'\n" if (!ok "$ans" , "ok" );
273 $try = "\$x = $class\->new(10); \$x = 20 / \$x;";
274 $try .= "'ok' if \$x == 2;"; $ans = eval $try;
275 print "# For '$try'\n" if (!ok "$ans" , "ok" );
277 $try = "\$x = $class\->new(3); \$x = 20 % \$x;";
278 $try .= "'ok' if \$x == 2;"; $ans = eval $try;
279 print "# For '$try'\n" if (!ok "$ans" , "ok" );
281 $try = "\$x = $class\->new(7); \$x = 20 & \$x;";
282 $try .= "'ok' if \$x == 4;"; $ans = eval $try;
283 print "# For '$try'\n" if (!ok "$ans" , "ok" );
285 $try = "\$x = $class\->new(7); \$x = 0x20 | \$x;";
286 $try .= "'ok' if \$x == 0x27;"; $ans = eval $try;
287 print "# For '$try'\n" if (!ok "$ans" , "ok" );
289 $try = "\$x = $class\->new(7); \$x = 0x20 ^ \$x;";
290 $try .= "'ok' if \$x == 0x27;"; $ans = eval $try;
291 print "# For '$try'\n" if (!ok "$ans" , "ok" );
293 ###############################################################################
294 # check badd(4,5) form
296 $try = "\$x = $class\->badd(4,5);";
297 $try .= "'ok' if \$x == 9;";
299 print "# For '$try'\n" if (!ok "$ans" , "ok" );
301 ###############################################################################
302 # check undefs: NOT DONE YET
304 ###############################################################################
307 $x = Math::BigInt->new(1); if ($x) { ok (1,1); } else { ok($x,'to be true') }
308 $x = Math::BigInt->new(0); if (!$x) { ok (1,1); } else { ok($x,'to be false') }
310 ###############################################################################
313 @args = Math::BigInt::objectify(2,4,5);
314 ok (scalar @args,3); # $class, 4, 5
315 ok ($args[0],$class);
319 @args = Math::BigInt::objectify(0,4,5);
320 ok (scalar @args,3); # $class, 4, 5
321 ok ($args[0],$class);
325 @args = Math::BigInt::objectify(2,4,5);
326 ok (scalar @args,3); # $class, 4, 5
327 ok ($args[0],$class);
331 @args = Math::BigInt::objectify(2,4,5,6,7);
332 ok (scalar @args,5); # $class, 4, 5, 6, 7
333 ok ($args[0],$class);
334 ok ($args[1],4); ok (ref($args[1]),$args[0]);
335 ok ($args[2],5); ok (ref($args[2]),$args[0]);
336 ok ($args[3],6); ok (ref($args[3]),'');
337 ok ($args[4],7); ok (ref($args[4]),'');
339 @args = Math::BigInt::objectify(2,$class,4,5,6,7);
340 ok (scalar @args,5); # $class, 4, 5, 6, 7
341 ok ($args[0],$class);
342 ok ($args[1],4); ok (ref($args[1]),$args[0]);
343 ok ($args[2],5); ok (ref($args[2]),$args[0]);
344 ok ($args[3],6); ok (ref($args[3]),'');
345 ok ($args[4],7); ok (ref($args[4]),'');
347 ###############################################################################
348 # test for floating-point input (other tests in bnorm() below)
350 $z = 1050000000000000; # may be int on systems with 64bit?
351 $x = $class->new($z); ok ($x->bsstr(),'105e+13'); # not 1.05e+15
352 $z = 1e+129; # definitely a float (may fail on UTS)
353 # don't compare to $z, since some Perl versions stringify $z into something
354 # like '1.e+129' or something equally ugly
355 $x = $class->new($z); ok ($x->bsstr(),'1e+129');
357 ###############################################################################
358 # prime number tests, also test for **= and length()
359 # found on: http://www.utm.edu/research/primes/notes/by_year.html
362 $x = $class->new(2); $x **= 148; $x++; $x = $x / 17;
363 ok ($x,"20988936657440586486151264256610222593863921");
364 ok ($x->length(),length "20988936657440586486151264256610222593863921");
367 $x = $class->new(2); $x **= 127; $x--;
368 ok ($x,"170141183460469231731687303715884105727");
370 $x = $class->new('215960156869840440586892398248');
371 ($x,$y) = $x->length();
372 ok ($x,30); ok ($y,0);
374 $x = $class->new('1_000_000_000_000');
375 ($x,$y) = $x->length();
376 ok ($x,13); ok ($y,0);
378 # I am afraid the following is not yet possible due to slowness
379 # Also, testing for 2 meg output is a bit hard ;)
380 #$x = $class->new(2); $x **= 6972593; $x--;
382 # 593573509*2^332162+1 has exactly 1,000,000 digits
383 # takes about 24 mins on 300 Mhz, so cannot be done yet ;)
384 #$x = $class->new(2); $x **= 332162; $x *= "593573509"; $x++;
385 #ok ($x->length(),1_000_000);
387 ###############################################################################
388 # inheritance and overriding of _swap
390 $x = Math::Foo->new(5);
391 $x = $x - 8; # 8 - 5 instead of 5-8
393 ok (ref($x),'Math::Foo');
395 $x = Math::Foo->new(5);
396 $x = 8 - $x; # 5 - 8 instead of 8 - 5
398 ok (ref($x),'Math::Foo');
400 ###############################################################################
401 # Test whether +inf eq inf
402 # This tried to test whether BigInt inf equals Perl inf. Unfortunately, Perl
403 # hasn't (before 5.7.3 at least) a consistent way to say inf, and some things
404 # like 1e100000 crash on some platforms. So simple test for the string 'inf'
405 $x = $class->new('+inf'); ok ($x,'inf');
407 ###############################################################################
408 ###############################################################################
409 # the followin tests only make sense with Math::BigInt::Calc or BareCalc
411 exit if $CALC !~ /^Math::BigInt::(Calc|BareCalc)$/; # for Pari et al.
413 ###############################################################################
414 # check proper length of internal arrays
416 my $bl = $CL->_base_len();
417 my $BASE = '9' x $bl;
421 $x = $class->new($MAX); is_valid($x); # f.i. 9999
422 $x += 1; ok ($x,$BASE); is_valid($x); # 10000
423 $x -= 1; ok ($x,$MAX); is_valid($x); # 9999 again
425 ###############################################################################
428 $x = $class->new($BASE-1); ok ($x->numify(),$BASE-1);
429 $x = $class->new(-($BASE-1)); ok ($x->numify(),-($BASE-1));
430 $x = $class->new($BASE); ok ($x->numify(),$BASE);
431 $x = $class->new(-$BASE); ok ($x->numify(),-$BASE);
432 $x = $class->new( -($BASE*$BASE*1+$BASE*1+1) );
433 ok($x->numify(),-($BASE*$BASE*1+$BASE*1+1));
435 ###############################################################################
436 # test bug in _digits with length($c[-1]) where $c[-1] was "00001" instead of 1
438 $x = $class->new($BASE-2); $x++; $x++; $x++; $x++;
439 if ($x > $BASE) { ok (1,1) } else { ok ("$x < $BASE","$x > $BASE"); }
441 $x = $class->new($BASE+3); $x++;
442 if ($x > $BASE) { ok (1,1) } else { ok ("$x > $BASE","$x < $BASE"); }
444 # test for +0 instead of int():
445 $x = $class->new($MAX); ok ($x->length(), length($MAX));
447 ###############################################################################
448 # bug in sub where number with at least 6 trailing zeros after any op failed
450 $x = $class->new(123456); $z = $class->new(10000); $z *= 10; $x -= $z;
454 ###############################################################################
455 # bug in shortcut in mul()
457 # construct a number with a zero-hole of BASE_LEN
458 $x = '1' x $bl . '0' x $bl . '1' x $bl . '0' x $bl;
460 $x = $class->new($x)->bmul($y);
461 # result is 123..$bl . $bl x (3*bl-1) . $bl...321 . '0' x $bl
463 for (my $i = 1; $i <= $bl; $i++)
465 $y .= $i; $d = $i.$d;
467 $y .= $bl x (3*$bl-1) . $d . '0' x $bl;
470 ###############################################################################
471 # see if mul shortcut for small numbers works
474 $x = $class->new($x);
475 # 999 * 999 => 998 . 001, 9999*9999 => 9998 . 0001
476 ok ($x*$x, '9' x ($bl-1) . '8' . '0' x ($bl-1) . '1');
478 ###############################################################################
479 # bug with rest "-0" in div, causing further div()s to fail
481 $x = $class->new('-322056000'); ($x,$y) = $x->bdiv('-12882240');
483 ok ($y,'0','not -0'); # not '-0'
486 ###############################################################################
487 # test whether bone/bzero take additional A & P, or reset it etc
489 $x = $class->new(2); $x->bzero(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
490 $x = $class->new(2); $x->binf(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
491 $x = $class->new(2); $x->bone(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
492 $x = $class->new(2); $x->bnan(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
494 $x = $class->new(2); $x->{_a} = 1; $x->{_p} = 2; $x->bnan();
495 ok_undef ($x->{_a}); ok_undef ($x->{_p});
496 $x = $class->new(2); $x->{_a} = 1; $x->{_p} = 2; $x->binf();
497 ok_undef ($x->{_a}); ok_undef ($x->{_p});
499 ### all tests done ############################################################
503 ###############################################################################
504 # Perl 5.005 does not like ok ($x,undef)
510 ok (1,1) and return if !defined $x;
514 ###############################################################################
515 # sub to check validity of a BigInt internally, to ensure that no op leaves a
516 # number object in an invalid state (f.i. "-0")
524 $e = 'Not a reference to Math::BigInt' if !ref($x);
527 $e = "Illegal sign $x->{sign} (expected: '+', '-', '-inf', '+inf' or 'NaN'"
528 if $e eq '0' && $x->{sign} !~ /^(\+|-|\+inf|-inf|NaN)$/;
530 $e = "-0 is invalid!" if $e ne '0' && $x->{sign} eq '-' && $x == 0;
531 $e = $CALC->_check($x->{value}) if $e eq '0';
533 # test done, see if error did crop up
534 ok (1,1), return if ($e eq '0');
536 ok (1,$e." after op '$f'");
604 -123456789:+987654321:-1
605 +123456789:-987654321:-1
606 +987654321:+123456789:1
607 -987654321:+123456789:1
639 0b1000000000000000000000000000000:1073741824
651 0x1_2_3_4_56_78:305419896
652 0xa_b_c_d_e_f:11259375
667 # only one underscore between two digits
685 # bug with two E's in number beeing valid
705 -123456789:-123456789
714 # floating point input
722 # non-integer numbers
757 # it must be exactly /^[+-]inf$/
764 +1:+48:+281474976710656
767 +12345:4:10:123450000
773 1234567890123:12:10:1234567890123000000000000
778 +281474976710656:+48:+1
789 1230000000000:10:10:123
790 09876123456789067890:12:10:9876123
791 1234561234567890123:13:10:123456
805 +123456789:-123456789
806 -123456789:+123456789
814 +123456789:+123456789
815 -123456789:+123456789
840 -123456789:+987654321:-1
841 +123456789:-987654321:1
842 -987654321:+123456789:-1
901 +9999999:+1:+10000000
902 +99999999:+1:+100000000
903 +999999999:+1:+1000000000
904 +9999999999:+1:+10000000000
905 +99999999999:+1:+100000000000
912 +10000000:-1:+9999999
913 +100000000:-1:+99999999
914 +1000000000:-1:+999999999
915 +10000000000:-1:+9999999999
916 +123456789:+987654321:+1111111110
917 -123456789:+987654321:+864197532
918 -123456789:-987654321:-1111111110
919 +123456789:-987654321:-864197532
944 +99999999:+1:+99999998
945 +999999999:+1:+999999998
946 +9999999999:+1:+9999999998
947 +99999999999:+1:+99999999998
954 +10000000:-1:+10000001
955 +100000000:-1:+100000001
956 +1000000000:-1:+1000000001
957 +10000000000:-1:+10000000001
958 +123456789:+987654321:-864197532
959 -123456789:+987654321:-1111111110
960 -123456789:-987654321:+864197532
961 +123456789:-987654321:+1111111110
979 +123456789123456789:+0:+0
980 +0:+123456789123456789:+0
990 +10101:+10101:+102030201
991 +1001001:+1001001:+1002003002001
992 +100010001:+100010001:+10002000300020001
993 +10000100001:+10000100001:+100002000030000200001
994 +11111111111:+9:+99999999999
995 +22222222222:+9:+199999999998
996 +33333333333:+9:+299999999997
997 +44444444444:+9:+399999999996
998 +55555555555:+9:+499999999995
999 +66666666666:+9:+599999999994
1000 +77777777777:+9:+699999999993
1001 +88888888888:+9:+799999999992
1002 +99999999999:+9:+899999999991
1004 +12345:+12345:+152399025
1005 +99999:+11111:+1111088889
1007 99999:100000:9999900000
1008 999999:1000000:999999000000
1009 9999999:10000000:99999990000000
1010 99999999:100000000:9999999900000000
1011 999999999:1000000000:999999999000000000
1012 9999999999:10000000000:99999999990000000000
1013 99999999999:100000000000:9999999999900000000000
1014 999999999999:1000000000000:999999999999000000000000
1015 9999999999999:10000000000000:99999999999990000000000000
1016 99999999999999:100000000000000:9999999999999900000000000000
1017 999999999999999:1000000000000000:999999999999999000000000000000
1018 9999999999999999:10000000000000000:99999999999999990000000000000000
1019 99999999999999999:100000000000000000:9999999999999999900000000000000000
1020 999999999999999999:1000000000000000000:999999999999999999000000000000000000
1021 9999999999999999999:10000000000000000000:99999999999999999990000000000000000000
1029 # inf handling and general remainder
1035 # see table in documentation in MBI
1054 # exceptions to reminder rule
1063 # inf handling (see table in doc)
1098 +1000000000:+9:+111111111
1099 +2000000000:+9:+222222222
1100 +3000000000:+9:+333333333
1101 +4000000000:+9:+444444444
1102 +5000000000:+9:+555555555
1103 +6000000000:+9:+666666666
1104 +7000000000:+9:+777777777
1105 +8000000000:+9:+888888888
1106 +9000000000:+9:+1000000000
1107 +35500000:+113:+314159
1108 +71000000:+226:+314159
1109 +106500000:+339:+314159
1110 +1000000000:+3:+333333333
1115 +999999999999:+9:+111111111111
1116 +999999999999:+99:+10101010101
1117 +999999999999:+999:+1001001001
1118 +999999999999:+9999:+100010001
1119 +999999999999999:+99999:+10000100001
1120 +1111088889:+99999:+11111
1135 # bug in Calc with '99999' vs $BASE-1
1136 10000000000000000000000000000000000000000000000000000000000000000000000000000000000:10000000375084540248994272022843165711074:999999962491547381984643365663244474111576
1138 # inf handling, see table in doc
1157 # exceptions to reminder rule
1193 +999999999999:+99:+0
1194 +999999999999:+999:+0
1195 +999999999999:+9999:+0
1196 +999999999999999:+99999:+0
1210 152403346:12345:4321
1243 +281474976710656:+0:+0
1244 +281474976710656:+1:+0
1245 +281474976710656:+281474976710656:+281474976710656
1252 # equal arguments are treated special, so also do some test with unequal ones
1253 0xFFFF:0xFFFF:0x0xFFFF
1254 0xFFFFFF:0xFFFFFF:0x0xFFFFFF
1255 0xFFFFFFFF:0xFFFFFFFF:0x0xFFFFFFFF
1256 0xFFFFFFFFFF:0xFFFFFFFFFF:0x0xFFFFFFFFFF
1257 0xFFFFFFFFFFFF:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
1258 0xF0F0:0xF0F0:0x0xF0F0
1259 0x0F0F:0x0F0F:0x0x0F0F
1260 0xF0F0F0:0xF0F0F0:0x0xF0F0F0
1261 0x0F0F0F:0x0F0F0F:0x0x0F0F0F
1262 0xF0F0F0F0:0xF0F0F0F0:0x0xF0F0F0F0
1263 0x0F0F0F0F:0x0F0F0F0F:0x0x0F0F0F0F
1264 0xF0F0F0F0F0:0xF0F0F0F0F0:0x0xF0F0F0F0F0
1265 0x0F0F0F0F0F:0x0F0F0F0F0F:0x0x0F0F0F0F0F
1266 0xF0F0F0F0F0F0:0xF0F0F0F0F0F0:0x0xF0F0F0F0F0F0
1267 0x0F0F0F0F0F0F:0x0F0F0F0F0F0F:0x0x0F0F0F0F0F0F
1268 0x1F0F0F0F0F0F:0x3F0F0F0F0F0F:0x0x1F0F0F0F0F0F
1275 +281474976710656:+0:+281474976710656
1276 +281474976710656:+1:+281474976710657
1277 +281474976710656:+281474976710656:+281474976710656
1283 # equal arguments are treated special, so also do some test with unequal ones
1284 0xFFFF:0xFFFF:0x0xFFFF
1285 0xFFFFFF:0xFFFFFF:0x0xFFFFFF
1286 0xFFFFFFFF:0xFFFFFFFF:0x0xFFFFFFFF
1287 0xFFFFFFFFFF:0xFFFFFFFFFF:0x0xFFFFFFFFFF
1288 0xFFFFFFFFFFFF:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
1290 0:0xFFFFFF:0x0xFFFFFF
1291 0:0xFFFFFFFF:0x0xFFFFFFFF
1292 0:0xFFFFFFFFFF:0x0xFFFFFFFFFF
1293 0:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
1295 0xFFFFFF:0:0x0xFFFFFF
1296 0xFFFFFFFF:0:0x0xFFFFFFFF
1297 0xFFFFFFFFFF:0:0x0xFFFFFFFFFF
1298 0xFFFFFFFFFFFF:0:0x0xFFFFFFFFFFFF
1299 0xF0F0:0xF0F0:0x0xF0F0
1300 0x0F0F:0x0F0F:0x0x0F0F
1301 0xF0F0:0x0F0F:0x0xFFFF
1302 0xF0F0F0:0xF0F0F0:0x0xF0F0F0
1303 0x0F0F0F:0x0F0F0F:0x0x0F0F0F
1304 0x0F0F0F:0xF0F0F0:0x0xFFFFFF
1305 0xF0F0F0F0:0xF0F0F0F0:0x0xF0F0F0F0
1306 0x0F0F0F0F:0x0F0F0F0F:0x0x0F0F0F0F
1307 0x0F0F0F0F:0xF0F0F0F0:0x0xFFFFFFFF
1308 0xF0F0F0F0F0:0xF0F0F0F0F0:0x0xF0F0F0F0F0
1309 0x0F0F0F0F0F:0x0F0F0F0F0F:0x0x0F0F0F0F0F
1310 0x0F0F0F0F0F:0xF0F0F0F0F0:0x0xFFFFFFFFFF
1311 0xF0F0F0F0F0F0:0xF0F0F0F0F0F0:0x0xF0F0F0F0F0F0
1312 0x0F0F0F0F0F0F:0x0F0F0F0F0F0F:0x0x0F0F0F0F0F0F
1313 0x0F0F0F0F0F0F:0xF0F0F0F0F0F0:0x0xFFFFFFFFFFFF
1314 0x1F0F0F0F0F0F:0xF0F0F0F0F0F0:0x0xFFFFFFFFFFFF
1321 +281474976710656:+0:+281474976710656
1322 +281474976710656:+1:+281474976710657
1323 +281474976710656:+281474976710656:+0
1331 # equal arguments are treated special, so also do some test with unequal ones
1334 0xFFFFFFFF:0xFFFFFFFF:0
1335 0xFFFFFFFFFF:0xFFFFFFFFFF:0
1336 0xFFFFFFFFFFFF:0xFFFFFFFFFFFF:0
1338 0:0xFFFFFF:0x0xFFFFFF
1339 0:0xFFFFFFFF:0x0xFFFFFFFF
1340 0:0xFFFFFFFFFF:0x0xFFFFFFFFFF
1341 0:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
1343 0xFFFFFF:0:0x0xFFFFFF
1344 0xFFFFFFFF:0:0x0xFFFFFFFF
1345 0xFFFFFFFFFF:0:0x0xFFFFFFFFFF
1346 0xFFFFFFFFFFFF:0:0x0xFFFFFFFFFFFF
1349 0xF0F0:0x0F0F:0x0xFFFF
1352 0x0F0F0F:0xF0F0F0:0x0xFFFFFF
1353 0xF0F0F0F0:0xF0F0F0F0:0
1354 0x0F0F0F0F:0x0F0F0F0F:0
1355 0x0F0F0F0F:0xF0F0F0F0:0x0xFFFFFFFF
1356 0xF0F0F0F0F0:0xF0F0F0F0F0:0
1357 0x0F0F0F0F0F:0x0F0F0F0F0F:0
1358 0x0F0F0F0F0F:0xF0F0F0F0F0:0x0xFFFFFFFFFF
1359 0xF0F0F0F0F0F0:0xF0F0F0F0F0F0:0
1360 0x0F0F0F0F0F0F:0x0F0F0F0F0F0F:0
1361 0x0F0F0F0F0F0F:0xF0F0F0F0F0F0:0x0xFFFFFFFFFFFF
1366 +281474976710656:-281474976710657
1446 -inf:1234500012:-inf
1447 +inf:-12345000123:inf
1448 -inf:-12345000123:-inf
1449 # 1 ** -x => 1 / (1 ** x)
1469 10:20:100000000000000000000
1470 123456:2:15241383936
1477 10000000000000000:17
1479 215960156869840440586892398248:30
1495 4000000000000:2000000
1506 $round_mode('trunc')
1516 +10123456789:5:+10123000000
1517 -10123456789:5:-10123000000
1518 +10123456789:9:+10123456700
1519 -10123456789:9:-10123456700
1520 +101234500:6:+101234000
1521 -101234500:6:-101234000
1522 #+101234500:-4:+101234000
1523 #-101234500:-4:-101234000
1525 +20123456789:5:+20123000000
1526 -20123456789:5:-20123000000
1527 +20123456789:9:+20123456800
1528 -20123456789:9:-20123456800
1529 +201234500:6:+201234000
1530 -201234500:6:-201234000
1531 #+201234500:-4:+201234000
1532 #-201234500:-4:-201234000
1533 +12345000:4:12340000
1534 -12345000:4:-12340000
1536 +30123456789:5:+30123000000
1537 -30123456789:5:-30123000000
1538 +30123456789:9:+30123456800
1539 -30123456789:9:-30123456800
1540 +301234500:6:+301235000
1541 -301234500:6:-301234000
1542 #+301234500:-4:+301235000
1543 #-301234500:-4:-301234000
1544 +12345000:4:12350000
1545 -12345000:4:-12340000
1547 +40123456789:5:+40123000000
1548 -40123456789:5:-40123000000
1549 +40123456789:9:+40123456800
1550 -40123456789:9:-40123456800
1551 +401234500:6:+401234000
1552 +401234500:6:+401234000
1553 #-401234500:-4:-401235000
1554 #-401234500:-4:-401235000
1555 +12345000:4:12340000
1556 -12345000:4:-12350000
1558 +50123456789:5:+50123000000
1559 -50123456789:5:-50123000000
1560 +50123456789:9:+50123456800
1561 -50123456789:9:-50123456800
1562 +501234500:6:+501235000
1563 -501234500:6:-501235000
1564 #+501234500:-4:+501235000
1565 #-501234500:-4:-501235000
1566 +12345000:4:12350000
1567 -12345000:4:-12350000
1569 +60123456789:5:+60123000000
1570 -60123456789:5:-60123000000
1571 +60123456789:9:+60123456800
1572 -60123456789:9:-60123456800
1573 +601234500:6:+601234000
1574 -601234500:6:-601234000
1575 #+601234500:-4:+601234000
1576 #-601234500:-4:-601234000
1583 +12345000:4:12340000
1584 -12345000:4:-12340000
1602 # floor and ceil tests are pretty pointless in integer space...but play safe
1629 0x123456789123456789:0x123456789123456789
1639 0b1010111101010101010110110110110110101:0b1010111101010101010110110110110110101