Upgrade to Math::BigInt 1.51.
[p5sagit/p5-mst-13.2.git] / lib / Math / BigInt / t / bigintpm.inc
1 #include this file into another for subclass testing
2
3 my $version = ${"$class\::VERSION"};
4
5 ##############################################################################
6 # for testing inheritance of _swap
7
8 package Math::Foo;
9
10 use Math::BigInt lib => $main::CL;
11 use vars qw/@ISA/;
12 @ISA = (qw/Math::BigInt/);
13
14 use overload
15 # customized overload for sub, since original does not use swap there
16 '-'     =>      sub { my @a = ref($_[0])->_swap(@_);
17                    $a[0]->bsub($a[1])};
18
19 sub _swap
20   {
21   # a fake _swap, which reverses the params
22   my $self = shift;                     # for override in subclass
23   if ($_[2])
24     {
25     my $c = ref ($_[0] ) || 'Math::Foo';
26     return ( $_[0]->copy(), $_[1] );
27     }
28   else
29     {
30     return ( Math::Foo->new($_[1]), $_[0] );
31     }
32   }
33
34 ##############################################################################
35 package main;
36
37 my $CALC = $class->config()->{lib}; ok ($CALC,$CL);
38
39 my ($f,$z,$a,$exp,@a,$m,$e,$round_mode,$expected_class);
40
41 while (<DATA>) 
42   {
43   chop;
44   next if /^#/; # skip comments
45   if (s/^&//) 
46     {
47     $f = $_; next;
48     }
49   elsif (/^\$/) 
50     {
51     $round_mode = $_; $round_mode =~ s/^\$/$class\->/; next;
52     }
53
54   @args = split(/:/,$_,99); $ans = pop(@args);
55   $expected_class = $class;
56   if ($ans =~ /(.*?)=(.*)/)
57     {
58     $expected_class = $2; $ans = $1;
59     }
60   $try = "\$x = $class->new(\"$args[0]\");";
61   if ($f eq "bnorm")
62     {
63     $try = "\$x = $class->bnorm(\"$args[0]\");";
64   # some is_xxx tests
65    } elsif ($f =~ /^is_(zero|one|odd|even|negative|positive|nan|int)$/) {
66     $try .= "\$x->$f();";
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]');";
77    # some unary ops
78    } elsif ($f =~ /^b(nan|floor|ceil|sstr|neg|abs|inc|dec|not|sqrt|fac)$/) {
79     $try .= "\$x->$f();";
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;';
93     $try .= '"$m,$e";';
94    } else {
95     $try .= "\$y = $class->new('$args[1]');";
96     if ($f eq "bcmp")
97       {
98       $try .= '$x <=> $y;';
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"){
104       $try .= '$x + $y;';
105       } elsif ($f eq "bsub"){
106       $try .= '$x - $y;';
107       } elsif ($f eq "bmul"){
108       $try .= '$x * $y;';
109       } elsif ($f eq "bdiv"){
110       $try .= '$x / $y;';
111       } elsif ($f eq "bdiv-list"){
112       $try .= 'join (",",$x->bdiv($y));';
113       # overload via x=
114       } elsif ($f =~ /^.=$/){
115       $try .= "\$x $f \$y;";
116       # overload via x
117       } elsif ($f =~ /^.$/){
118       $try .= "\$x $f \$y;";
119       } elsif ($f eq "bmod"){
120       $try .= '$x % $y;';
121       } elsif ($f eq "bgcd")
122         {
123         if (defined $args[2])
124           {
125           $try .= " \$z = $class->new('$args[2]'); ";
126           }
127         $try .= "$class\::bgcd(\$x, \$y";
128         $try .= ", \$z" if (defined $args[2]);
129         $try .= " );";
130         }
131       elsif ($f eq "blcm")
132         {
133         if (defined $args[2])
134           {
135           $try .= " \$z = $class->new('$args[2]'); ";
136           }
137         $try .= "$class\::blcm(\$x, \$y";
138         $try .= ", \$z" if (defined $args[2]);
139         $try .= " );";
140       }elsif ($f eq "blsft"){
141         if (defined $args[2])
142           {
143           $try .= "\$x->blsft(\$y,$args[2]);";
144           }
145         else
146           {
147           $try .= "\$x << \$y;";
148           }
149       }elsif ($f eq "brsft"){
150         if (defined $args[2])
151           {
152           $try .= "\$x->brsft(\$y,$args[2]);";
153           }
154         else
155           {
156           $try .= "\$x >> \$y;";
157           }
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
170
171   $ans1 = eval $try;
172   # convert hex/binary targets to decimal       
173   if ($ans =~ /^(0x0x|0b0b)/)
174     {
175     $ans =~ s/^0[xb]//; $ans = Math::BigInt->new($ans)->bstr();
176     }
177   if ($ans eq "")
178     {
179     ok_undef ($ans1); 
180     }
181   else
182     {
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;
186     }
187   # check internal state of number objects
188   is_valid($ans1,$f) if ref $ans1; 
189   } # endwhile data tests
190 close DATA;
191
192 # test some more
193 @a = ();
194 for (my $i = 1; $i < 10; $i++) 
195   {
196   push @a, $i;
197   }
198 ok "@a", "1 2 3 4 5 6 7 8 9";
199
200 # test whether self-multiplication works correctly (result is 2**64)
201 $try = "\$x = $class->new('4294967296');";
202 $try .= '$a = $x->bmul($x);';
203 $ans1 = eval $try;
204 print "# Tried: '$try'\n" if !ok ($ans1, $class->new(2) ** 64);
205 # test self-pow
206 $try = "\$x = $class->new(10);";
207 $try .= '$a = $x->bpow($x);';
208 $ans1 = eval $try;
209 print "# Tried: '$try'\n" if !ok ($ans1, $class->new(10) ** 10);
210
211 # test whether op destroys args or not (should better not)
212
213 $x = $class->new(3);
214 $y = $class->new(4);
215 $z = $x & $y;
216 ok ($x,3);
217 ok ($y,4);
218 ok ($z,0);
219 $z = $x | $y;
220 ok ($x,3);
221 ok ($y,4);
222 ok ($z,7);
223 $x = $class->new(1);
224 $y = $class->new(2);
225 $z = $x | $y;
226 ok ($x,1);
227 ok ($y,2);
228 ok ($z,3);
229
230 $x = $class->new(5);
231 $y = $class->new(4);
232 $z = $x ^ $y;
233 ok ($x,5);
234 ok ($y,4);
235 ok ($z,1);
236
237 $x = $class->new(-5); $y = -$x;
238 ok ($x, -5);
239
240 $x = $class->new(-5); $y = abs($x);
241 ok ($x, -5);
242
243 # check whether overloading cmp works
244 $try = "\$x = $class->new(0);";
245 $try .= "\$y = 10;";
246 $try .= "'false' if \$x ne \$y;";
247 $ans = eval $try;
248 print "# For '$try'\n" if (!ok "$ans" , "false" ); 
249
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
252
253 ###############################################################################
254 # check reversed order of arguments
255
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" ); 
259
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" ); 
263
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" ); 
267
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" ); 
271
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" ); 
275
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" ); 
279
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" ); 
283
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" ); 
287
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" ); 
291
292 ###############################################################################
293 # check badd(4,5) form
294
295 $try = "\$x = $class\->badd(4,5);";
296 $try .= "'ok' if \$x == 9;";
297 $ans = eval $try;
298 print "# For '$try'\n" if (!ok "$ans" , "ok" ); 
299
300 ###############################################################################
301 # check undefs: NOT DONE YET
302
303 ###############################################################################
304 # bool
305
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') }
308
309 ###############################################################################
310 # objectify()
311
312 @args = Math::BigInt::objectify(2,4,5);
313 ok (scalar @args,3);            # $class, 4, 5
314 ok ($args[0],$class);
315 ok ($args[1],4);
316 ok ($args[2],5);
317
318 @args = Math::BigInt::objectify(0,4,5);
319 ok (scalar @args,3);            # $class, 4, 5
320 ok ($args[0],$class);
321 ok ($args[1],4);
322 ok ($args[2],5);
323
324 @args = Math::BigInt::objectify(2,4,5);
325 ok (scalar @args,3);            # $class, 4, 5
326 ok ($args[0],$class);
327 ok ($args[1],4);
328 ok ($args[2],5);
329
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]),'');
337
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]),'');
345
346 ###############################################################################
347 # test for floating-point input (other tests in bnorm() below)
348
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');
355
356 ###############################################################################
357 # prime number tests, also test for **= and length()
358 # found on: http://www.utm.edu/research/primes/notes/by_year.html
359
360 # ((2^148)-1)/17
361 $x = $class->new(2); $x **= 148; $x++; $x = $x / 17;
362 ok ($x,"20988936657440586486151264256610222593863921");
363 ok ($x->length(),length "20988936657440586486151264256610222593863921");
364
365 # MM7 = 2^127-1
366 $x = $class->new(2); $x **= 127; $x--;
367 ok ($x,"170141183460469231731687303715884105727");
368
369 $x = $class->new('215960156869840440586892398248');
370 ($x,$y) = $x->length();
371 ok ($x,30); ok ($y,0);
372
373 $x = $class->new('1_000_000_000_000');
374 ($x,$y) = $x->length();
375 ok ($x,13); ok ($y,0);
376
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--;
380
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);
385
386 ###############################################################################
387 # inheritance and overriding of _swap
388
389 $x = Math::Foo->new(5);
390 $x = $x - 8;            # 8 - 5 instead of 5-8
391 ok ($x,3);
392 ok (ref($x),'Math::Foo');
393
394 $x = Math::Foo->new(5);
395 $x = 8 - $x;            # 5 - 8 instead of 8 - 5
396 ok ($x,-3);
397 ok (ref($x),'Math::Foo');
398
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');
405
406 ###############################################################################
407 ###############################################################################
408 # the followin tests only make sense with Math::BigInt::Calc or BareCalc
409
410 exit if $CALC !~ /^Math::BigInt::(Calc|BareCalc)$/; # for Pari et al.
411
412 ###############################################################################
413 # check proper length of internal arrays
414
415 my $bl = $CL->_base_len();
416 my $BASE = '9' x $bl;
417 my $MAX = $BASE;
418 $BASE++;
419
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
423
424 ###############################################################################
425 # check numify
426
427 $x = $class->new($BASE-1);     ok ($x->numify(),$BASE-1); 
428 $x = $class->new(-($BASE-1));  ok ($x->numify(),-($BASE-1)); 
429
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)); 
435
436 ###############################################################################
437 # test bug in _digits with length($c[-1]) where $c[-1] was "00001" instead of 1
438
439 $x = $class->new($BASE-2); $x++; $x++; $x++; $x++;
440 if ($x > $BASE) { ok (1,1) } else { ok ("$x < $BASE","$x > $BASE"); }
441
442 $x = $class->new($BASE+3); $x++;
443 if ($x > $BASE) { ok (1,1) } else { ok ("$x > $BASE","$x < $BASE"); }
444
445 # test for +0 instead of int(): 
446 $x = $class->new($MAX); ok ($x->length(), length($MAX));
447
448 ###############################################################################
449 # bug in sub where number with at least 6 trailing zeros after any op failed
450
451 $x = $class->new(123456); $z = $class->new(10000); $z *= 10; $x -= $z;
452 ok ($z, 100000);
453 ok ($x, 23456);
454
455 ###############################################################################
456 # bug in shortcut in mul()
457
458 # construct a number with a zero-hole of BASE_LEN_SMALL
459 {
460  my @bl = $CL->_base_len(); my $bl = $bl[4];
461
462  $x = '1' x $bl . '0' x $bl . '1' x $bl . '0' x $bl;
463  $y = '1' x (2*$bl);
464  $x = $class->new($x)->bmul($y);
465  # result is 123..$bl .  $bl x (3*bl-1) . $bl...321 . '0' x $bl
466  $y = ''; my $d = '';
467  for (my $i = 1; $i <= $bl; $i++)
468    {
469    $y .= $i; $d = $i.$d;
470    }
471  $y .= $bl x (3*$bl-1) . $d . '0' x $bl;
472  ok ($x,$y);
473
474
475 ###############################################################################
476 # see if mul shortcut for small numbers works
477
478 $x = '9' x $bl;
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');
482
483  }
484
485 ###############################################################################
486 # bug with rest "-0" in div, causing further div()s to fail
487
488 $x = $class->new('-322056000'); ($x,$y) = $x->bdiv('-12882240');
489
490 ok ($y,'0'); is_valid($y);      # $y not '-0'
491
492 # all tests done
493
494 1;
495
496 ###############################################################################
497 ###############################################################################
498 # Perl 5.005 does not like ok ($x,undef)
499
500 sub ok_undef
501   {
502   my $x = shift;
503
504   ok (1,1) and return if !defined $x;
505   ok ($x,'undef');
506   }
507
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")
511
512 sub is_valid
513   {
514   my ($x,$f) = @_;
515
516   my $e = 0;                    # error?
517   # ok as reference? 
518   $e = 'Not a reference to Math::BigInt' if !ref($x);
519
520   # has ok sign?
521   $e = "Illegal sign $x->{sign} (expected: '+', '-', '-inf', '+inf' or 'NaN'"
522    if $e eq '0' && $x->{sign} !~ /^(\+|-|\+inf|-inf|NaN)$/;
523
524   $e = "-0 is invalid!" if $e ne '0' && $x->{sign} eq '-' && $x == 0;
525   $e = $CALC->_check($x->{value}) if $e eq '0';
526
527   # test done, see if error did crop up
528   ok (1,1), return if ($e eq '0');
529
530   ok (1,$e." after op '$f'");
531   }
532
533 __DATA__
534 &.=
535 1234:-345:1234-345
536 &+=
537 1:2:3
538 -1:-2:-3
539 &-=
540 1:2:-1
541 -1:-2:1
542 &*=
543 2:3:6
544 -1:5:-5
545 &%=
546 100:3:1
547 8:9:8
548 &/=
549 100:3:33
550 -8:2:-4
551 &|=
552 2:1:3
553 &&=
554 5:7:5
555 &^=
556 5:7:2
557 &is_negative
558 0:0
559 -1:1
560 1:0
561 +inf:0
562 -inf:1
563 NaNneg:0
564 &is_positive
565 0:1
566 -1:0
567 1:1
568 +inf:1
569 -inf:0
570 NaNneg:0
571 &is_int
572 -inf:0
573 +inf:0
574 NaNis_int:0
575 1:1
576 0:1
577 123e12:1
578 &is_odd
579 abc:0
580 0:0
581 1:1
582 3:1
583 -1:1
584 -3:1
585 10000001:1
586 10000002:0
587 2:0
588 120:0
589 121:1
590 &is_even
591 abc:0
592 0:1
593 1:0
594 3:0
595 -1:0
596 -3:0
597 10000001:0
598 10000002:1
599 2:1
600 120:1
601 121:0
602 &bacmp
603 +0:-0:0
604 +0:+1:-1
605 -1:+1:0
606 +1:-1:0
607 -1:+2:-1
608 +2:-1:1
609 -123456789:+987654321:-1
610 +123456789:-987654321:-1
611 +987654321:+123456789:1
612 -987654321:+123456789:1
613 -123:+4567889:-1
614 # NaNs
615 acmpNaN:123:
616 123:acmpNaN:
617 acmpNaN:acmpNaN:
618 # infinity
619 +inf:+inf:0
620 -inf:-inf:0
621 +inf:-inf:0
622 -inf:+inf:0
623 +inf:123:1
624 -inf:123:1
625 +inf:-123:1
626 -inf:-123:1
627 # return undef
628 +inf:NaN:
629 NaN:inf:
630 -inf:NaN:
631 NaN:-inf:
632 &bnorm
633 123:123
634 # binary input
635 0babc:NaN
636 0b123:NaN
637 0b0:0
638 -0b0:0
639 -0b1:-1
640 0b0001:1
641 0b001:1
642 0b011:3
643 0b101:5
644 0b1001:9
645 0b10001:17
646 0b100001:33
647 0b1000001:65
648 0b10000001:129
649 0b100000001:257
650 0b1000000001:513
651 0b10000000001:1025
652 0b100000000001:2049
653 0b1000000000001:4097
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
676 0b_101:NaN
677 0b1_0_1:5
678 0b0_0_0_1:1
679 # hex input
680 -0x0:0
681 0xabcdefgh:NaN
682 0x1234:4660
683 0xabcdef:11259375
684 -0xABCDEF:-11259375
685 -0x1234:-4660
686 0x12345678:305419896
687 0x1_2_3_4_56_78:305419896
688 0xa_b_c_d_e_f:11259375
689 0x_123:NaN
690 0x9:9
691 0x11:17
692 0x21:33
693 0x41:65
694 0x81:129
695 0x101:257
696 0x201:513
697 0x401:1025
698 0x801:2049
699 0x1001:4097
700 0x2001:8193
701 0x4001:16385
702 0x8001:32769
703 0x10001:65537
704 0x20001:131073
705 0x40001:262145
706 0x80001:524289
707 0x100001:1048577
708 0x200001:2097153
709 0x400001:4194305
710 0x800001:8388609
711 0x1000001:16777217
712 0x2000001:33554433
713 0x4000001:67108865
714 0x8000001:134217729
715 0x10000001:268435457
716 0x20000001:536870913
717 0x40000001:1073741825
718 0x80000001:2147483649
719 0x100000001:4294967297
720 0x200000001:8589934593
721 0x400000001:17179869185
722 0x800000001:34359738369
723 # inf input
724 inf:inf
725 +inf:inf
726 -inf:-inf
727 0inf:NaN
728 # abnormal input
729 :NaN
730 abc:NaN
731    1 a:NaN
732 1bcd2:NaN
733 11111b:NaN
734 +1z:NaN
735 -1z:NaN
736 # only one underscore between two digits
737 _123:NaN
738 _123_:NaN
739 123_:NaN
740 1__23:NaN
741 1E1__2:NaN
742 1_E12:NaN
743 1E_12:NaN
744 1_E_12:NaN
745 +_1E12:NaN
746 +0_1E2:100
747 +0_0_1E2:100
748 -0_0_1E2:-100
749 -0_0_1E+0_0_2:-100
750 E1:NaN
751 E23:NaN
752 1.23E1:NaN
753 1.23E-1:NaN
754 # bug with two E's in number beeing valid
755 1e2e3:NaN
756 1e2r:NaN
757 1e2.0:NaN
758 # leading zeros
759 012:12
760 0123:123
761 01234:1234
762 012345:12345
763 0123456:123456
764 01234567:1234567
765 012345678:12345678
766 0123456789:123456789
767 01234567891:1234567891
768 012345678912:12345678912
769 0123456789123:123456789123
770 01234567891234:1234567891234
771 # normal input
772 0:0
773 +0:0
774 +00:0
775 +000:0
776 000000000000000000:0
777 -0:0
778 -0000:0
779 +1:1
780 +01:1
781 +001:1
782 +00000100000:100000
783 123456789:123456789
784 -1:-1
785 -01:-1
786 -001:-1
787 -123456789:-123456789
788 -00000100000:-100000
789 1_2_3:123
790 10000000000E-1_0:1
791 1E2:100
792 1E1:10
793 1E0:1
794 1.23E2:123
795 100E-1:10
796 # floating point input
797 # .2e2:20
798 1.E3:1000
799 1.01E2:101
800 1010E-1:101
801 -1010E0:-1010
802 -1010E1:-10100
803 1234.00:1234
804 # non-integer numbers
805 -1010E-2:NaN
806 -1.01E+1:NaN
807 -1.01E-1:NaN
808 &bnan
809 1:NaN
810 2:NaN
811 abc:NaN
812 &bone
813 2:+:1
814 2:-:-1
815 boneNaN:-:-1
816 boneNaN:+:1
817 2:abc:1
818 3::1
819 &binf
820 1:+:inf
821 2:-:-inf
822 3:abc:inf
823 &is_nan
824 123:0
825 abc:1
826 NaN:1
827 -123:0
828 &is_inf
829 +inf::1
830 -inf::1
831 abc::0
832 1::0
833 NaN::0
834 -1::0
835 +inf:-:0
836 +inf:+:1
837 -inf:-:1
838 -inf:+:0
839 # it must be exactly /^[+-]inf$/
840 +infinity::0
841 -infinity::0
842 &blsft
843 abc:abc:NaN
844 +2:+2:8
845 +1:+32:4294967296
846 +1:+48:281474976710656
847 +8:-2:NaN
848 # excercise base 10
849 +12345:4:10:123450000
850 -1234:0:10:-1234
851 +1234:0:10:1234
852 +2:2:10:200
853 +12:2:10:1200
854 +1234:-3:10:NaN
855 1234567890123:12:10:1234567890123000000000000
856 -3:1:2:-6
857 -5:1:2:-10
858 -2:1:2:-4
859 -102533203:1:2:-205066406
860 &brsft
861 abc:abc:NaN
862 +8:+2:2
863 +4294967296:+32:1
864 +281474976710656:+48:1
865 +2:-2:NaN
866 # excercise base 10
867 -1234:0:10:-1234
868 +1234:0:10:1234
869 +200:2:10:2
870 +1234:3:10:1
871 +1234:2:10:12
872 +1234:-3:10:NaN
873 310000:4:10:31
874 12300000:5:10:123
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
880 -15:1:2:-8
881 -14:1:2:-7
882 -13:1:2:-7
883 -12:1:2:-6
884 -11:1:2:-6
885 -10:1:2:-5
886 -9:1:2:-5
887 -8:1:2:-4
888 -7:1:2:-4
889 -6:1:2:-3
890 -5:1:2:-3
891 -4:1:2:-2
892 -3:1:2:-2
893 -2:1:2:-1
894 -1:1:2:-1
895 -1640531254:2:2:-410132814
896 -1640531254:1:2:-820265627
897 -820265627:1:2:-410132814
898 -205066405:1:2:-102533203
899 &bsstr
900 1e+34:1e+34
901 123.456E3:123456e+0
902 100:1e+2
903 abc:NaN
904 &bneg
905 bnegNaN:NaN
906 +inf:-inf
907 -inf:inf
908 abd:NaN
909 0:0
910 1:-1
911 -1:1
912 +123456789:-123456789
913 -123456789:123456789
914 &babs
915 babsNaN:NaN
916 +inf:inf
917 -inf:inf
918 0:0
919 1:1
920 -1:1
921 +123456789:123456789
922 -123456789:123456789
923 &bcmp
924 bcmpNaN:bcmpNaN:
925 bcmpNaN:0:
926 0:bcmpNaN:
927 0:0:0
928 -1:0:-1
929 0:-1:1
930 1:0:1
931 0:1:-1
932 -1:1:-1
933 1:-1:1
934 -1:-1:0
935 1:1:0
936 123:123:0
937 123:12:1
938 12:123:-1
939 -123:-123:0
940 -123:-12:-1
941 -12:-123:1
942 123:124:-1
943 124:123:1
944 -123:-124:1
945 -124:-123:-1
946 100:5:1
947 -123456789:987654321:-1
948 +123456789:-987654321:1
949 -987654321:123456789:-1
950 -inf:5432112345:-1
951 +inf:5432112345:1
952 -inf:-5432112345:-1
953 +inf:-5432112345:1
954 +inf:+inf:0
955 -inf:-inf:0
956 +inf:-inf:1
957 -inf:+inf:-1
958 5:inf:-1
959 5:inf:-1
960 -5:-inf:1
961 -5:-inf:1
962 # return undef
963 +inf:NaN:
964 NaN:inf:
965 -inf:NaN:
966 NaN:-inf:
967 &binc
968 abc:NaN
969 +inf:inf
970 -inf:-inf
971 +0:1
972 +1:2
973 -1:0
974 &bdec
975 abc:NaN
976 +inf:inf
977 -inf:-inf
978 +0:-1
979 +1:0
980 -1:-2
981 &badd
982 abc:abc:NaN
983 abc:0:NaN
984 +0:abc:NaN
985 +inf:-inf:NaN
986 -inf:+inf:NaN
987 +inf:+inf:inf
988 -inf:-inf:-inf
989 baddNaN:+inf:NaN
990 baddNaN:+inf:NaN
991 +inf:baddNaN:NaN
992 -inf:baddNaN:NaN
993 0:0:0
994 1:0:1
995 0:1:1
996 1:1:2
997 -1:0:-1
998 0:-1:-1
999 -1:-1:-2
1000 -1:+1:0
1001 +1:-1:0
1002 +9:+1:10
1003 +99:+1:100
1004 +999:+1:1000
1005 +9999:+1:10000
1006 +99999:+1:100000
1007 +999999:+1:1000000
1008 +9999999:+1:10000000
1009 +99999999:+1:100000000
1010 +999999999:+1:1000000000
1011 +9999999999:+1:10000000000
1012 +99999999999:+1:100000000000
1013 +10:-1:9
1014 +100:-1:99
1015 +1000:-1:999
1016 +10000:-1:9999
1017 +100000:-1:99999
1018 +1000000:-1:999999
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
1027 &bsub
1028 abc:abc:NaN
1029 abc:+0:NaN
1030 +0:abc:NaN
1031 +inf:-inf:inf
1032 -inf:+inf:-inf
1033 +inf:+inf:NaN
1034 -inf:-inf:NaN
1035 +0:+0:0
1036 +1:+0:1
1037 +0:+1:-1
1038 +1:+1:0
1039 -1:+0:-1
1040 +0:-1:1
1041 -1:-1:0
1042 -1:+1:-2
1043 +1:-1:2
1044 +9:+1:8
1045 +99:+1:98
1046 +999:+1:998
1047 +9999:+1:9998
1048 +99999:+1:99998
1049 +999999:+1:999998
1050 +9999999:+1:9999998
1051 +99999999:+1:99999998
1052 +999999999:+1:999999998
1053 +9999999999:+1:9999999998
1054 +99999999999:+1:99999999998
1055 +10:-1:11
1056 +100:-1:101
1057 +1000:-1:1001
1058 +10000:-1:10001
1059 +100000:-1:100001
1060 +1000000:-1:1000001
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
1069 &bmul
1070 abc:abc:NaN
1071 abc:+0:NaN
1072 +0:abc:NaN
1073 NaNmul:+inf:NaN
1074 NaNmul:-inf:NaN
1075 -inf:NaNmul:NaN
1076 +inf:NaNmul:NaN
1077 +inf:+inf:inf
1078 +inf:-inf:-inf
1079 -inf:+inf:-inf
1080 -inf:-inf:inf
1081 +0:+0:0
1082 +0:+1:0
1083 +1:+0:0
1084 +0:-1:0
1085 -1:+0:0
1086 123456789123456789:0:0
1087 0:123456789123456789:0
1088 -1:-1:1
1089 -1:+1:-1
1090 +1:-1:-1
1091 +1:+1:1
1092 +2:+3:6
1093 -2:+3:-6
1094 +2:-3:-6
1095 -2:-3:6
1096 111:111:12321
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
1110 +25:+25:625
1111 +12345:+12345:152399025
1112 +99999:+11111:1111088889
1113 9999:10000:99990000
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
1129 &bdiv-list
1130 100:20:5,0
1131 4095:4095:1,0
1132 -4095:-4095:1,0
1133 4095:-4095:-1,0
1134 -4095:4095:-1,0
1135 123:2:61,1
1136 9:5:1,4
1137 9:4:2,1
1138 # inf handling and general remainder
1139 5:8:0,5
1140 0:8:0,0
1141 11:2:5,1
1142 11:-2:-5,-1
1143 -11:2:-5,1
1144 # see table in documentation in MBI
1145 0:inf:0,0
1146 0:-inf:0,0
1147 5:inf:0,5
1148 5:-inf:0,5
1149 -5:inf:0,-5
1150 -5:-inf:0,-5
1151 inf:5:inf,0
1152 -inf:5:-inf,0
1153 inf:-5:-inf,0
1154 -inf:-5:inf,0
1155 5:5:1,0
1156 -5:-5:1,0
1157 inf:inf:NaN,NaN
1158 -inf:-inf:NaN,NaN
1159 -inf:inf:NaN,NaN
1160 inf:-inf:NaN,NaN
1161 8:0:inf,8
1162 inf:0:inf,inf
1163 # exceptions to reminder rule
1164 -8:0:-inf,-8
1165 -inf:0:-inf,-inf
1166 0:0:NaN,NaN
1167 &bdiv
1168 abc:abc:NaN
1169 abc:1:NaN
1170 1:abc:NaN
1171 0:0:NaN
1172 # inf handling (see table in doc)
1173 0:inf:0
1174 0:-inf:0
1175 5:inf:0
1176 5:-inf:0
1177 -5:inf:0
1178 -5:-inf:0
1179 inf:5:inf
1180 -inf:5:-inf
1181 inf:-5:-inf
1182 -inf:-5:inf
1183 5:5:1
1184 -5:-5:1
1185 inf:inf:NaN
1186 -inf:-inf:NaN
1187 -inf:inf:NaN
1188 inf:-inf:NaN
1189 8:0:inf
1190 inf:0:inf
1191 -8:0:-inf
1192 -inf:0:-inf
1193 0:0:NaN
1194 11:2:5
1195 -11:-2:5
1196 -11:2:-5
1197 11:-2:-5
1198 0:1:0
1199 0:-1:0
1200 1:1:1
1201 -1:-1:1
1202 1:-1:-1
1203 -1:1:-1
1204 1:2:0
1205 2:1:2
1206 1:26:0
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
1216 35500000:113:314159
1217 71000000:226:314159
1218 106500000:339:314159
1219 1000000000:3:333333333
1220 +10:+5:2
1221 +100:+4:25
1222 +1000:+8:125
1223 +10000:+16:625
1224 999999999999:9:111111111111
1225 999999999999:99:10101010101
1226 999999999999:999:1001001001
1227 999999999999:9999:100010001
1228 999999999999999:99999:10000100001
1229 +1111088889:99999:11111
1230 -5:-3:1
1231 -5:3:-1
1232 4:3:1
1233 4:-3:-1
1234 1:3:0
1235 1:-3:0
1236 -2:-3:0
1237 -2:3:0
1238 8:3:2
1239 -8:3:-2
1240 14:-3:-4
1241 -14:3:-4
1242 -14:-3:4
1243 14:3:4
1244 # bug in Calc with '99999' vs $BASE-1
1245 10000000000000000000000000000000000000000000000000000000000000000000000000000000000:10000000375084540248994272022843165711074:999999962491547381984643365663244474111576
1246 &bmod
1247 # inf handling, see table in doc
1248 0:inf:0
1249 0:-inf:0
1250 5:inf:5
1251 5:-inf:5
1252 -5:inf:-5
1253 -5:-inf:-5
1254 inf:5:0
1255 -inf:5:0
1256 inf:-5:0
1257 -inf:-5:0
1258 5:5:0
1259 -5:-5:0
1260 inf:inf:NaN
1261 -inf:-inf:NaN
1262 -inf:inf:NaN
1263 inf:-inf:NaN
1264 8:0:8
1265 inf:0:inf
1266 # exceptions to reminder rule
1267 -inf:0:-inf
1268 -8:0:-8
1269 0:0:NaN
1270 abc:abc:NaN
1271 abc:1:abc:NaN
1272 1:abc:NaN
1273 0:0:NaN
1274 0:1:0
1275 1:0:1
1276 0:-1:0
1277 -1:0:-1
1278 1:1:0
1279 -1:-1:0
1280 1:-1:0
1281 -1:1:0
1282 1:2:1
1283 2:1:0
1284 1000000000:9:1
1285 2000000000:9:2
1286 3000000000:9:3
1287 4000000000:9:4
1288 5000000000:9:5
1289 6000000000:9:6
1290 7000000000:9:7
1291 8000000000:9:8
1292 9000000000:9:0
1293 35500000:113:33
1294 71000000:226:66
1295 106500000:339:99
1296 1000000000:3:1
1297 10:5:0
1298 100:4:0
1299 1000:8:0
1300 10000:16:0
1301 999999999999:9:0
1302 999999999999:99:0
1303 999999999999:999:0
1304 999999999999:9999:0
1305 999999999999999:99999:0
1306 -9:+5:1
1307 +9:-5:-1
1308 -9:-5:-4
1309 -5:3:1
1310 -2:3:1
1311 4:3:1
1312 1:3:1
1313 -5:-3:-2
1314 -2:-3:-2
1315 4:-3:-2
1316 1:-3:-2
1317 4095:4095:0
1318 100041000510123:3:0
1319 152403346:12345:4321
1320 9:5:4
1321 &bgcd
1322 abc:abc:NaN
1323 abc:+0:NaN
1324 +0:abc:NaN
1325 +0:+0:0
1326 +0:+1:1
1327 +1:+0:1
1328 +1:+1:1
1329 +2:+3:1
1330 +3:+2:1
1331 -3:+2:1
1332 100:625:25
1333 4096:81:1
1334 1034:804:2
1335 27:90:56:1
1336 27:90:54:9
1337 &blcm
1338 abc:abc:NaN
1339 abc:+0:NaN
1340 +0:abc:NaN
1341 +0:+0:NaN
1342 +1:+0:0
1343 +0:+1:0
1344 +27:+90:270
1345 +1034:+804:415668
1346 &band
1347 abc:abc:NaN
1348 abc:0:NaN
1349 0:abc:NaN
1350 1:2:0
1351 3:2:2
1352 +8:+2:0
1353 +281474976710656:0:0
1354 +281474976710656:1:0
1355 +281474976710656:+281474976710656:281474976710656
1356 -2:-3:-4
1357 -1:-1:-1
1358 -6:-6:-6
1359 -7:-4:-8
1360 -7:4:0
1361 -4:7:4
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
1379 &bior
1380 abc:abc:NaN
1381 abc:0:NaN
1382 0:abc:NaN
1383 1:2:3
1384 +8:+2:10
1385 +281474976710656:0:281474976710656
1386 +281474976710656:1:281474976710657
1387 +281474976710656:281474976710656:281474976710656
1388 -2:-3:-1
1389 -1:-1:-1
1390 -6:-6:-6
1391 -7:4:-3
1392 -4:7:-1
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
1399 0:0xFFFF:0x0xFFFF
1400 0:0xFFFFFF:0x0xFFFFFF
1401 0:0xFFFFFFFF:0x0xFFFFFFFF
1402 0:0xFFFFFFFFFF:0x0xFFFFFFFFFF
1403 0:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
1404 0xFFFF:0:0x0xFFFF
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
1425 &bxor
1426 abc:abc:NaN
1427 abc:0:NaN
1428 0:abc:NaN
1429 1:2:3
1430 +8:+2:10
1431 +281474976710656:0:281474976710656
1432 +281474976710656:1:281474976710657
1433 +281474976710656:281474976710656:0
1434 -2:-3:3
1435 -1:-1:0
1436 -6:-6:0
1437 -7:4:-3
1438 -4:7:-5
1439 4:-7:-3
1440 -4:-7:5
1441 # equal arguments are treated special, so also do some test with unequal ones
1442 0xFFFF:0xFFFF:0
1443 0xFFFFFF:0xFFFFFF:0
1444 0xFFFFFFFF:0xFFFFFFFF:0
1445 0xFFFFFFFFFF:0xFFFFFFFFFF:0
1446 0xFFFFFFFFFFFF:0xFFFFFFFFFFFF:0
1447 0:0xFFFF:0x0xFFFF
1448 0:0xFFFFFF:0x0xFFFFFF
1449 0:0xFFFFFFFF:0x0xFFFFFFFF
1450 0:0xFFFFFFFFFF:0x0xFFFFFFFFFF
1451 0:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
1452 0xFFFF:0:0x0xFFFF
1453 0xFFFFFF:0:0x0xFFFFFF
1454 0xFFFFFFFF:0:0x0xFFFFFFFF
1455 0xFFFFFFFFFF:0:0x0xFFFFFFFFFF
1456 0xFFFFFFFFFFFF:0:0x0xFFFFFFFFFFFF
1457 0xF0F0:0xF0F0:0
1458 0x0F0F:0x0F0F:0
1459 0xF0F0:0x0F0F:0x0xFFFF
1460 0xF0F0F0:0xF0F0F0:0
1461 0x0F0F0F:0x0F0F0F:0
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
1472 &bnot
1473 abc:NaN
1474 +0:-1
1475 +8:-9
1476 +281474976710656:-281474976710657
1477 -1:0
1478 -2:1
1479 -12:11
1480 &digit
1481 0:0:0
1482 12:0:2
1483 12:1:1
1484 123:0:3
1485 123:1:2
1486 123:2:1
1487 123:-1:1
1488 123:-2:2
1489 123:-3:3
1490 123456:0:6
1491 123456:1:5
1492 123456:2:4
1493 123456:3:3
1494 123456:4:2
1495 123456:5:1
1496 123456:-1:1
1497 123456:-2:2
1498 123456:-3:3
1499 100000:-3:0
1500 100000:0:0
1501 100000:1:0
1502 &mantissa
1503 abc:NaN
1504 1e4:1
1505 2e0:2
1506 123:123
1507 -1:-1
1508 -2:-2
1509 +inf:inf
1510 -inf:-inf
1511 &exponent
1512 abc:NaN
1513 1e4:4
1514 2e0:0
1515 123:0
1516 -1:0
1517 -2:0
1518 0:1
1519 +inf:inf
1520 -inf:inf
1521 &parts
1522 abc:NaN,NaN
1523 1e4:1,4
1524 2e0:2,0
1525 123:123,0
1526 -1:-1,0
1527 -2:-2,0
1528 0:0,1
1529 +inf:inf,inf
1530 -inf:-inf,inf
1531 &bfac
1532 -1:NaN
1533 NaNfac:NaN
1534 +inf:NaN
1535 -inf:NaN
1536 0:1
1537 1:1
1538 2:2
1539 3:6
1540 4:24
1541 5:120
1542 6:720
1543 10:3628800
1544 11:39916800
1545 12:479001600
1546 &bpow
1547 abc:12:NaN
1548 12:abc:NaN
1549 0:0:1
1550 0:1:0
1551 0:2:0
1552 0:-1:NaN
1553 0:-2:NaN
1554 1:0:1
1555 1:1:1
1556 1:2:1
1557 1:3:1
1558 1:-1:1
1559 1:-2:1
1560 1:-3:1
1561 2:0:1
1562 2:1:2
1563 2:2:4
1564 2:3:8
1565 3:3:27
1566 2:-1:NaN
1567 -2:-1:NaN
1568 2:-2:NaN
1569 -2:-2:NaN
1570 +inf:1234500012:inf
1571 -inf:1234500012:-inf
1572 +inf:-12345000123:inf
1573 -inf:-12345000123:-inf
1574 # 1 ** -x => 1 / (1 ** x)
1575 -1:0:1
1576 -2:0:1
1577 -1:1:-1
1578 -1:2:1
1579 -1:3:-1
1580 -1:4:1
1581 -1:5:-1
1582 -1:-1:-1
1583 -1:-2:1
1584 -1:-3:-1
1585 -1:-4:1
1586 10:2:100
1587 10:3:1000
1588 10:4:10000
1589 10:5:100000
1590 10:6:1000000
1591 10:7:10000000
1592 10:8:100000000
1593 10:9:1000000000
1594 10:20:100000000000000000000
1595 123456:2:15241383936
1596 &length
1597 100:3
1598 10:2
1599 1:1
1600 0:1
1601 12345:5
1602 10000000000000000:17
1603 -123:3
1604 215960156869840440586892398248:30
1605 &bsqrt
1606 145:12
1607 144:12
1608 143:11
1609 16:4
1610 170:13
1611 169:13
1612 168:12
1613 4:2
1614 3:1
1615 2:1
1616 9:3
1617 12:3
1618 256:16
1619 100000000:10000
1620 4000000000000:2000000
1621 152399026:12345
1622 152399025:12345
1623 152399024:12344
1624 1:1
1625 0:0
1626 -2:NaN
1627 -123:NaN
1628 Nan:NaN
1629 +inf:NaN
1630 &bround
1631 $round_mode('trunc')
1632 0:12:0
1633 NaNbround:12:NaN
1634 +inf:12:inf
1635 -inf:12:-inf
1636 1234:0:1234
1637 1234:2:1200
1638 123456:4:123400
1639 123456:5:123450
1640 123456:6:123456
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
1649 $round_mode('zero')
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
1660 $round_mode('+inf')
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
1671 $round_mode('-inf')
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
1682 $round_mode('odd')
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
1693 $round_mode('even')
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
1702 #-601234500:-9:0
1703 #-501234500:-9:0
1704 #-601234500:-8:0
1705 #-501234500:-8:0
1706 +1234567:7:1234567
1707 +1234567:6:1234570
1708 +12345000:4:12340000
1709 -12345000:4:-12340000
1710 &is_zero
1711 0:1
1712 NaNzero:0
1713 +inf:0
1714 -inf:0
1715 123:0
1716 -1:0
1717 1:0
1718 &is_one
1719 0:0
1720 NaNone:0
1721 +inf:0
1722 -inf:0
1723 1:1
1724 2:0
1725 -1:0
1726 -2:0
1727 # floor and ceil tests are pretty pointless in integer space...but play safe
1728 &bfloor
1729 0:0
1730 NaNfloor:NaN
1731 +inf:inf
1732 -inf:-inf
1733 -1:-1
1734 -2:-2
1735 2:2
1736 3:3
1737 abc:NaN
1738 &bceil
1739 NaNceil:NaN
1740 +inf:inf
1741 -inf:-inf
1742 0:0
1743 -1:-1
1744 -2:-2
1745 2:2
1746 3:3
1747 abc:NaN
1748 &as_hex
1749 128:0x80
1750 -128:-0x80
1751 0:0x0
1752 -0:0x0
1753 1:0x1
1754 0x123456789123456789:0x123456789123456789
1755 +inf:inf
1756 -inf:-inf
1757 NaNas_hex:NaN
1758 &as_bin
1759 128:0b10000000
1760 -128:-0b10000000
1761 0:0b0
1762 -0:0b0
1763 1:0b1
1764 0b1010111101010101010110110110110110101:0b1010111101010101010110110110110110101
1765 +inf:inf
1766 -inf:-inf
1767 NaNas_bin:NaN