1#include this file into another test for subclass testing...
2
3use strict;
4use warnings;
5
6our ($CLASS, $try, $x, $y, $z, $f, @args, $want, $got, $setup, $LIB);
7
8is($CLASS->config()->{lib}, $LIB);
9
10$setup = '';
11
12while (<DATA>) {
13    s/#.*$//;                   # remove comments
14    s/\s+$//;                   # remove trailing whitespace
15    next unless length;         # skip empty lines
16
17    if (s/^&//) {
18        $f = $_;
19        next;
20    }
21
22    if (/^\$/) {
23        $setup = $_;
24        $setup =~ s/\$/\$${CLASS}::/g;  # round_mode, div_scale
25        #print "\$setup== $setup\n";
26        next;
27    }
28
29    if (m|^(.*?):(/.+)$|) {
30        $want = $2;
31        @args = split(/:/, $1, 99);
32    } else {
33        @args = split(/:/, $_, 99);
34        $want = pop(@args);
35    }
36
37    $try = qq|\$x = $CLASS->new("$args[0]");|;
38    if ($f eq "bnorm") {
39        $try .= " \$x;";
40    } elsif ($f eq "finf") {
41        my $a = $args[1] || '';
42        $try .= qq| \$x->binf("$a");|;
43    } elsif ($f eq "fone") {
44        $try .= qq| \$x->bone("$args[1]");|;
45    } elsif ($f eq "fstr") {
46        $try .= " \$x->accuracy($args[1]); \$x->precision($args[2]);";
47        $try .= ' $x->bstr();';
48    } elsif ($f eq "parts") {
49        # ->bstr() to see if an object is returned
50        $try .= ' ($a,$b) = $x->parts(); $a = $a->bstr(); $b = $b->bstr();';
51        $try .= ' "$a $b";';
52    } elsif ($f eq "numerator") {
53        # ->bstr() to see if an object is returned
54        $try .= ' $x->numerator()->bstr();';
55    } elsif ($f eq "denominator") {
56        # ->bstr() to see if an object is returned
57        $try .= ' $x->denominator()->bstr();';
58    } elsif ($f =~ /^(length|numify)$/) {
59        $try .= " \$x->$f();";
60        # some unary ops (can't test the fxxx form, since no AUTOLOAD in BigRat)
61    } elsif ($f =~ /^f(nan|sstr|neg|floor|ceil|abs)$/) {
62        $try .= " \$x->b$1();";
63        # overloaded functions
64    } elsif ($f =~ /^(log|exp|sin|cos|atan2|int|neg|abs|sqrt)$/) {
65        $try .= " \$x = $f(\$x);";
66        # some is_xxx test function
67    } elsif ($f =~ /^is_(zero|pos|neg|negative|positive|odd|even|nan|int)\z/) {
68        $try .= " \$x->$f();";
69    } elsif ($f =~ /^is_(one|inf)$/) {
70        $try .= @args == 1 ? qq| \$x->$f();|
71                           : qq| \$x->$f("$args[1]");|;
72    } elsif ($f =~ /^(as_number|as_int)\z/) {
73        $try .= " \$x->$1();";
74    } elsif ($f eq "finc") {
75        $try .= ' ++$x;';
76    } elsif ($f eq "fdec") {
77        $try .= ' --$x;';
78    } elsif ($f eq "digit") {
79        $try .= " \$x->digit($args[1]);";
80    } elsif ($f eq "fround") {
81        $try .= " $setup; \$x->bround($args[1]);";
82    } elsif ($f eq "ffround") {
83        $try .= " $setup; \$x->bfround($args[1]);";
84    } elsif ($f eq "fsqrt") {
85        $try .= " $setup; \$x->bsqrt();";
86    } elsif ($f eq "flog") {
87        $try .= " $setup; \$x->blog();";
88    } elsif ($f eq "ffac") {
89        $try .= " $setup; \$x->bfac();";
90    } else {
91        $try .= qq| \$y = $CLASS->new("$args[1]");|;
92        if ($f eq "bcmp") {
93            $try .= ' $x <=> $y;';
94        } elsif ($f eq "bacmp") {
95            $try .= ' $x->bacmp($y);';
96        } elsif ($f eq "bpow") {
97            $try .= ' $x->bpow($y);';
98        } elsif ($f eq "badd") {
99            $try .= ' $x + $y;';
100        } elsif ($f eq "bsub") {
101            $try .= ' $x - $y;';
102        } elsif ($f eq "bmul") {
103            $try .= ' $x * $y;';
104        } elsif ($f eq "bdiv") {
105            $try .= " $setup; \$x / \$y;";
106        } elsif ($f eq "bdiv-list") {
107            $try .= qq| $setup; join(",", \$x->bdiv(\$y));|;
108        } elsif ($f eq "brsft") {
109            $try .= ' $x >> $y;';
110        } elsif ($f eq "blsft") {
111            $try .= ' $x << $y;';
112        } elsif ($f eq "bmod") {
113            $try .= ' $x % $y;';
114        } elsif ($f eq "bmodinv") {
115            $try .= " \$x->bmodinv(\$y);";
116        } elsif ($f eq "blog") {
117            $try .= " \$x->blog(\$y);";
118        } else {
119            $try .= qq| \$z = $CLASS->new("$args[2]");|;
120
121            # Functions with three arguments
122            if ($f eq "bmodpow") {
123                $try .= " \$x->bmodpow(\$y, \$z);";
124            } else {
125                warn "Unknown op '$f'";
126            }
127        }
128    }
129    # print "# Trying: '$try'\n";
130    $got = eval $try;
131    if ($want =~ m|^/(.*)$|) {
132        my $pat = $1;
133        like($got, qr/$pat/, $try);
134    } else {
135        if ($want eq "") {
136            is($got, undef, $try);
137        } else {
138            is($got, $want, $try);
139            #if (ref($got) eq "$CLASS") {
140            #    # float numbers are normalized (for now), so mantissa shouldn't have
141            #    # trailing zeros
142            #    #print $got->_trailing_zeros(), "\n";
143            #    print "# Has trailing zeros after '$try'\n"
144            #      if !is($got->{_m}->_trailing_zeros(), 0);
145            #}
146        }
147    }                           # end pattern or string
148}                               # end while
149
150# check whether $CLASS->new(Math::BigInt->new()) destroys it
151# ($y == 12 in this case)
152$x = Math::BigInt->new(1200);
153$y = $CLASS->new($x);
154is($y, 1200, qq|\$x = Math::BigInt->new(1200); \$y = $CLASS->new(\$x); $y|);
155is($x, 1200, qq|\$x = Math::BigInt->new(1200); \$y = $CLASS->new(\$x); $x|);
156
157###############################################################################
158# zero, inf, one, nan
159
160$x = $CLASS->new(2);
161$x->bzero();
162is($x->{_a}, undef, qq|\$x = $CLASS->new(2); \$x->bzero(); \$x->{_a}|);
163is($x->{_p}, undef, qq|\$x = $CLASS->new(2); \$x->bzero(); \$x->{_p}|);
164
165$x = $CLASS->new(2);
166$x->binf();
167is($x->{_a}, undef, qq|\$x = $CLASS->new(2); \$x->binf(); \$x->{_a}|);
168is($x->{_p}, undef, qq|\$x = $CLASS->new(2); \$x->binf(); \$x->{_p}|);
169
170$x = $CLASS->new(2);
171$x->bone();
172is($x->{_a}, undef, qq|\$x = $CLASS->new(2); \$x->bone(); \$x->{_a}|);
173is($x->{_p}, undef, qq|\$x = $CLASS->new(2); \$x->bone(); \$x->{_p}|);
174
175$x = $CLASS->new(2);
176$x->bnan();
177is($x->{_a}, undef, qq|\$x = $CLASS->new(2); \$x->bnan(); \$x->{_a}|);
178is($x->{_p}, undef, qq|\$x = $CLASS->new(2); \$x->bnan(); \$x->{_p}|);
179
180__DATA__
181
182&digit
183123:2:1
1841234:0:4
1851234:1:3
1861234:2:2
1871234:3:1
1881234:-1:1
1891234:-2:2
1901234:-3:3
1911234:-4:4
1920:0:0
1930:1:0
194
195&bmodinv
196# format: number:modulus:result
197# bmodinv Data errors
198abc:abc:NaN
199abc:5:NaN
2005:abc:NaN
201# bmodinv Expected Results from normal use
2021:5:1
2033:5:2
2043:-5:-3
205-2:5:2
2068:5033:4404
2071234567891:13:6
208-1234567891:13:7
209324958749843759385732954874325984357439658735983745:2348249874968739:1741662881064902
210## bmodinv Error cases / useless use of function
211inf:5:NaN
2125:inf:NaN
213-inf:5:NaN
2145:-inf:NaN
215
216&as_number
217144/7:20
21812/1:12
219-12/1:-12
220-12/3:-4
221NaN:NaN
222+inf:inf
223-inf:-inf
224
225&as_int
226144/7:20
22712/1:12
228-12/1:-12
229-12/3:-4
230NaN:NaN
231+inf:inf
232-inf:-inf
233
234&bmodpow
235# format: number:exponent:modulus:result
236# bmodpow Data errors
237abc:abc:abc:NaN
2385:abc:abc:NaN
239abc:5:abc:NaN
240abc:abc:5:NaN
2415:5:abc:NaN
2425:abc:5:NaN
243abc:5:5:NaN
244# bmodpow Expected results
2450:0:2:1
2461:0:2:1
2470:0:1:0
2488:7:5032:3840
2498:-1:5033:4404
2508:8:-5:-4
25198436739867439843769485798542749827593285729587325:43698764986460981048259837659386739857456983759328457:6943857329857295827698367:3104744730915914415259518
252# bmodpow Error cases
2538:-1:16:NaN
254inf:5:13:NaN
2555:inf:13:NaN
256
257&bmod
258NaN:1:NaN
2591:NaN:NaN
2601:1:0
2612:2:0
26212:6:0
2637/4:4/14:1/28
2647/4:4/16:0
265-7/4:4/16:0
266-7/4:-4/16:0
2677/4:-4/16:0
2687/4:4/32:0
269-7/4:4/32:0
270-7/4:-4/32:0
2717/4:-4/32:0
2727/4:4/28:1/28
273-7/4:4/28:3/28
2747/4:-4/28:-3/28
275-7/4:-4/28:-1/28
276
277&fsqrt
2781:1
2790:0
280NaN:NaN
281+inf:inf
282-inf:NaN
283144:12
284# sqrt(144) / sqrt(4) = 12/2 = 6/1
285144/4:6
28625/16:5/4
287-3:NaN
2884/9:2/3
28936/49:6/7
29049/121:7/11
291999966000289/99999820000081:999983/9999991
292
293&flog
294NaN:NaN
2950:-inf
296-2:NaN
297
298&blog
299NaN:NaN:NaN
3000:NaN:NaN
301NaN:0:NaN
302NaN:1:NaN
3031:NaN:NaN
3040:2:-inf
3050:-2:NaN
3063:-2:NaN
307
308&finf
3091:+:inf
3102:-:-inf
3113:abc:inf
312
313&numify
3140:0
315+1:1
3161234:1234
3173/4:0.75
3185/2:2.5
3193/2:1.5
3205/4:1.25
321
322&fnan
323abc:NaN
3242:NaN
325-2:NaN
3260:NaN
327
328&fone
3292:+:1
330-2:-:-1
331-2:+:1
3322:-:-1
3330::1
334-2::1
335abc::1
3362:abc:1
337
338&fsstr
339+inf:inf
340-inf:-inf
341abcfsstr:NaN
3421:1
3433/1:3
3440.1:1/10
345
346&bnorm
3471:1
348-0:0
349bnormNaN:NaN
350+inf:inf
351-inf:-inf
352inf/inf:NaN
3535/inf:0
3545/-inf:0
355inf/5:inf
356-inf/5:-inf
357inf/-5:-inf
358-inf/-5:inf
359123:123
360-123.4567:-1234567/10000
361#1.E3:NaN
362.2E-3.:NaN
363#1e3e4:NaN
364.2E2:20
365inf:inf
366+inf:inf
367-inf:-inf
368+InFiNiTy:inf
369+-inf:NaN
370abc:NaN
371   1 a:NaN
3721bcd2:NaN
37311111b:NaN
374+1z:NaN
375-1z:NaN
3760:0
377+0:0
378+00:0
379+0_0_0:0
380000000_0000000_00000:0
381-0:0
382-0000:0
383+1:1
384+01:1
385+001:1
386+00000100000:100000
387+00000800/00000010:80
388-00000800/00000010:-80
389+00000800/-00000010:-80
390-00000800/-00000010:80
391123456789:123456789
392-1:-1
393-01:-1
394-001:-1
395-123456789:-123456789
396-00000100000:-100000
397123.456a:NaN
398123.456:15432/125
3990.01:1/100
400.002:1/500
401+.2:1/5
402-0.0003:-3/10000
403-.0000000004:-1/2500000000
404123456E2:12345600
405123456E-2:30864/25
406-123456E2:-12345600
407-123456E-2:-30864/25
4081e1:10
4092e-11:1/50000000000
41012/10:6/5
4110.1/0.1:1
412100/0.1:1000
4130.1/10:1/100
4141 / 3:1/3
4151/ 3:1/3
4161 /3:1/3
417
418&fneg
419fnegNaN:NaN
420+inf:-inf
421-inf:inf
422+0:0
423+1:-1
424-1:1
425+123456789:-123456789
426-123456789:123456789
427+123.456789:-123456789/1000000
428-123456.789:123456789/1000
429123/7:-123/7
430-123/7:123/7
431123/-7:123/7
432
433&fabs
434fabsNaN:NaN
435+inf:inf
436-inf:inf
437+0:0
438+1:1
439-1:1
440+123456789:123456789
441-123456789:123456789
442+123.456789:123456789/1000000
443-123456.789:123456789/1000
444
445&badd
446abc:abc:NaN
447abc:+0:NaN
448+0:abc:NaN
449+inf:-inf:NaN
450-inf:+inf:NaN
451+inf:+inf:inf
452-inf:-inf:-inf
453baddNaN:+inf:NaN
454baddNaN:+inf:NaN
455+inf:baddNaN:NaN
456-inf:baddNaN:NaN
457+0:+0:0
458+1:+0:1
459+0:+1:1
460+1:+1:2
461-1:+0:-1
462+0:-1:-1
463-1:-1:-2
464-1:+1:0
465+1:-1:0
466+9:+1:10
467+99:+1:100
468+999:+1:1000
469+9999:+1:10000
470+99999:+1:100000
471+999999:+1:1000000
472+9999999:+1:10000000
473+99999999:+1:100000000
474+999999999:+1:1000000000
475+9999999999:+1:10000000000
476+99999999999:+1:100000000000
477+10:-1:9
478+100:-1:99
479+1000:-1:999
480+10000:-1:9999
481+100000:-1:99999
482+1000000:-1:999999
483+10000000:-1:9999999
484+100000000:-1:99999999
485+1000000000:-1:999999999
486+10000000000:-1:9999999999
487+123456789:+987654321:1111111110
488-123456789:+987654321:864197532
489-123456789:-987654321:-1111111110
490+123456789:-987654321:-864197532
4911/3:1/3:2/3
4922/3:-1/3:1/3
493
494&bsub
495abc:abc:NaN
496abc:+0:NaN
497+0:abc:NaN
498+inf:-inf:inf
499-inf:+inf:-inf
500+inf:+inf:NaN
501-inf:-inf:NaN
502baddNaN:+inf:NaN
503baddNaN:+inf:NaN
504+inf:baddNaN:NaN
505-inf:baddNaN:NaN
506+0:+0:0
507+1:+0:1
508+0:+1:-1
509+1:+1:0
510-1:+0:-1
511+0:-1:1
512-1:-1:0
513-1:+1:-2
514+1:-1:2
515+9:+1:8
516+99:+1:98
517+999:+1:998
518+9999:+1:9998
519+99999:+1:99998
520+999999:+1:999998
521+9999999:+1:9999998
522+99999999:+1:99999998
523+999999999:+1:999999998
524+9999999999:+1:9999999998
525+99999999999:+1:99999999998
526+10:-1:11
527+100:-1:101
528+1000:-1:1001
529+10000:-1:10001
530+100000:-1:100001
531+1000000:-1:1000001
532+10000000:-1:10000001
533+100000000:-1:100000001
534+1000000000:-1:1000000001
535+10000000000:-1:10000000001
536+123456789:+987654321:-864197532
537-123456789:+987654321:-1111111110
538-123456789:-987654321:864197532
539+123456789:-987654321:1111111110
5402/3:1/3:1/3
5417/27:3/54:11/54
542-2/3:+2/3:-4/3
543-2/3:-2/3:0
5440:-123:123
5450:123:-123
546
547&bmul
548abc:abc:NaN
549abc:+0:NaN
550+0:abc:NaN
551+inf:NaNmul:NaN
552+inf:NaNmul:NaN
553NaNmul:+inf:NaN
554NaNmul:-inf:NaN
555+inf:+inf:inf
556+inf:-inf:-inf
557+inf:-inf:-inf
558+inf:+inf:inf
559+inf:123.34:inf
560+inf:-123.34:-inf
561-inf:123.34:-inf
562-inf:-123.34:inf
563123.34:+inf:inf
564-123.34:+inf:-inf
565123.34:-inf:-inf
566-123.34:-inf:inf
567+0:+0:0
568+0:+1:0
569+1:+0:0
570+0:-1:0
571-1:+0:0
572+123456789123456789:+0:0
573+0:+123456789123456789:0
574-1:-1:1
575-1:+1:-1
576+1:-1:-1
577+1:+1:1
578+2:+3:6
579-2:+3:-6
580+2:-3:-6
581-2:-3:6
582+111:+111:12321
583+10101:+10101:102030201
584+1001001:+1001001:1002003002001
585+100010001:+100010001:10002000300020001
586+10000100001:+10000100001:100002000030000200001
587+11111111111:+9:99999999999
588+22222222222:+9:199999999998
589+33333333333:+9:299999999997
590+44444444444:+9:399999999996
591+55555555555:+9:499999999995
592+66666666666:+9:599999999994
593+77777777777:+9:699999999993
594+88888888888:+9:799999999992
595+99999999999:+9:899999999991
5966:120:720
59710:10000:100000
5981/4:1/3:1/12
599
600&bdiv-list
6010:0:NaN,0
6020:1:0,0
6031:0:inf,1
604-1:0:-inf,-1
6059:4:2,1
606-9:4:-3,3
6079:-4:-3,-3
608-9:-4:2,-1
60911/7:2/3:2,5/21
610-11/7:2/3:-3,3/7
611
612&bdiv
613$div_scale = 40; $round_mode = "even"
614abc:abc:NaN
615abc:+1:abc:NaN
616+1:abc:NaN
617-1:abc:NaN
6180:abc:NaN
619+0:+0:NaN
620+0:+1:0
621+1:+0:inf
622+3214:+0:inf
623+0:-1:0
624-1:+0:-inf
625-3214:+0:-inf
626+1:+1:1
627-1:-1:1
628+1:-1:-1
629-1:+1:-1
630+1:+2:1/2
631+2:+1:2
632123:+inf:0
633123:-inf:0
634+10:+5:2
635+100:+4:25
636+1000:+8:125
637+10000:+16:625
638+10000:-16:-625
639+999999999999:+9:111111111111
640+999999999999:+99:10101010101
641+999999999999:+999:1001001001
642+999999999999:+9999:100010001
643+999999999999999:+99999:10000100001
644+1000000000:+9:1000000000/9
645+2000000000:+9:2000000000/9
646+3000000000:+9:1000000000/3
647+4000000000:+9:4000000000/9
648+5000000000:+9:5000000000/9
649+6000000000:+9:2000000000/3
650+7000000000:+9:7000000000/9
651+8000000000:+9:8000000000/9
652+9000000000:+9:1000000000
653+35500000:+113:35500000/113
654+71000000:+226:35500000/113
655+106500000:+339:35500000/113
656+1000000000:+3:1000000000/3
6572:25.024996000799840031993601279744051189762:1000000000000000000000000000000000000000/12512498000399920015996800639872025594881
658123456:1:123456
6591/4:1/3:3/4
660# reset scale for further tests
661$div_scale = 40
662
663&is_nan
664123:0
665abc:1
666NaN:1
667-123:0
668
669&is_inf
670# without sign argument
671abc:0
672NaN:0
673+inf:1
674-inf:1
675-1:0
6760:0
6771:0
678# with sign argument "+"
679abc:+:0
680NaN:+:0
681+inf:+:1
682-inf:+:0
683-1:+:0
6840:+:0
6851:+:0
686# with sign argument "-"
687abc:-:0
688NaN:-:0
689+inf:-:0
690-inf:-:1
691-1:-:0
6920:-:0
6931:-:0
694+infinity:1
695-infinity:1
696
697&is_odd
698abc:0
6990:0
700-1:1
701-3:1
7021:1
7033:1
7041000001:1
7051000002:0
706+inf:0
707-inf:0
708123.45:0
709-123.45:0
7102:0
711
712&is_int
713NaNis_int:0
7140:1
7151:1
7162:1
717-2:1
718-1:1
719-inf:0
720+inf:0
721123.4567:0
722-0.1:0
723-0.002:0
7241/3:0
7253/1:1
726
727&is_even
728abc:0
7290:1
730-1:0
731-3:0
7321:0
7333:0
7341000001:0
7351000002:1
7362:1
737+inf:0
738-inf:0
739123.456:0
740-123.456:0
7410.01:0
742-0.01:0
743120:1
7441200:1
745-1200:1
746
747&is_pos
7480:0
7491:1
750-1:0
751-123:0
752NaN:0
753-inf:0
754+inf:1
755
756&is_positive
7570:0
7581:1
759-1:0
760-123:0
761NaN:0
762-inf:0
763+inf:1
764
765&is_neg
7660:0
7671:0
768-1:1
769-123:1
770NaN:0
771-inf:1
772+inf:0
773
774&is_negative
7750:0
7761:0
777-1:1
778-123:1
779NaN:0
780-inf:1
781+inf:0
782
783&parts
7840:0 1
7851:1 1
786123:123 1
787-123:-123 1
788-1200:-1200 1
7895/7:5 7
790-5/7:-5 7
791NaNparts:NaN NaN
792+inf:inf inf
793-inf:-inf inf
794
795&length
796123:3
797-123:3
7980:1
7991:1
80012345678901234567890:20
801
802&is_zero
803NaNzero:0
804+inf:0
805-inf:0
8060:1
807-1:0
8081:0
8090/3:1
8101/3:0
811-0/3:1
8125/inf:1
813
814&is_one
815# with no sign argument
816invalid:0
817NaN:0
818+inf:0
819-inf:0
820-2:0
821-1:0
8220:0
8231:1
824-2:0
825# with sign argument "+"
826invalid:+:0
827NaN:+:0
828+inf:+:0
829-inf:+:0
830-2:+:0
831-1:+:0
8320:+:0
8331:+:1
834-2:+:0
835# with sign argument "-"
836invalid:-:0
837NaN:-:0
838+inf:-:0
839-inf:-:0
840-2:-:0
841-1:-:1
8420:-:0
8431:-:0
844-2:-:0
8451/3:0
846100/100:1
8470.1/0.1:1
8485/inf:0
849
850&ffloor
8510:0
852abc:NaN
853+inf:inf
854-inf:-inf
8551:1
856-51:-51
857-51.2:-52
85812.2:12
8593/7:0
8606/7:0
8617/7:1
8628/7:1
86313/7:1
86414/7:2
86515/7:2
866-3/7:-1
867-6/7:-1
868-7/1:-7
869-8/7:-2
870-13/7:-2
871-14/7:-2
872-15/7:-3
873
874&fceil
8750:0
876abc:NaN
877+inf:inf
878-inf:-inf
8791:1
880-51:-51
881-51.2:-51
88212.2:13
8833/7:1
8846/7:1
8858/7:2
88613/7:2
88714/7:2
88815/7:3
889-3/7:0
890-6/7:0
891-8/7:-1
892-13/7:-1
893-14/7:-2
894-15/7:-2
895
896&ffac
897NaN:NaN
8981:1
899-1:NaN
900
901&bpow
902#
903abc:123:NaN
904123:abc:NaN
905#
906-inf:-inf:0
907-inf:-3:0
908-inf:-2:0
909-inf:-3/2:0
910-inf:-1:0
911-inf:-1/2:0
912-inf:0:NaN
913-inf:1/2:inf    # directed infinity
914-inf:1:-inf
915-inf:3/2:inf    # directed infinity
916-inf:2:inf
917-inf:3:-inf
918-inf:inf:inf    # complex infinity
919-inf:NaN:NaN
920#
921-3:-inf:0
922-3:-3:-1/27
923-3:-2:1/9
924-3:-3/2:NaN
925-3:-1:-1/3
926-3:-1/2:NaN
927-3:0:1
928-3:1/2:NaN
929-3:1:-3
930-3:3/2:NaN
931-3:2:9
932-3:3:-27
933-3:inf:inf      # complex infinity
934-3:NaN:NaN
935#
936-2:-inf:0
937-2:-3:-1/8
938-2:-2:1/4
939-2:-3/2:NaN
940-2:-1:-1/2
941-2:-1/2:NaN
942-2:0:1
943-2:1/2:NaN
944-2:1:-2
945-2:3/2:NaN
946-2:2:4
947-2:3:-8
948-2:inf:inf      # complex infinity
949-2:NaN:NaN
950#
951-3/2:-inf:0
952-3/2:-3:-8/27
953-3/2:-2:4/9
954-3/2:-3/2:NaN
955-3/2:-1:-2/3
956-3/2:-1/2:NaN
957-3/2:0:1
958-3/2:1/2:NaN
959-3/2:1:-3/2
960-3/2:3/2:NaN
961-3/2:2:9/4
962-3/2:3:-27/8
963-3/2:inf:inf    # complex infinity
964-3/2:NaN:NaN
965#
966-1:-inf:NaN
967-1:-3:-1
968-1:-2:1
969-1:-3/2:NaN
970-1:-1:-1
971-1:-1/2:NaN
972-1:0:1
973-1:1/2:NaN
974-1:1:-1
975-1:3/2:NaN
976-1:2:1
977-1:3:-1
978-1:inf:NaN
979-1:NaN:NaN
980#
981-1/2:-inf:inf   # complex infinity
982-1/2:-3:-8
983-1/2:-2:4
984-1/2:-3/2:NaN
985-1/2:-1:-2
986-1/2:-1/2:NaN
987-1/2:0:1
988-1/2:1/2:NaN
989-1/2:1:-1/2
990-1/2:3/2:NaN
991-1/2:2:1/4
992-1/2:3:-1/8
993-1/2:inf:0
994-1/2:NaN:NaN
995#
9960:-inf:inf      # complex infinity
9970:-3:inf        # complex infinity
9980:-2:inf        # complex infinity
9990:-3/2:inf      # complex infinity
10000:-1:inf        # complex infinity
10010:-1/2:inf      # complex infinity
10020:0:1
10030:1/2:0
10040:1:0
10050:3/2:0
10060:2:0
10070:3:0
10080:inf:0
10090:NaN:NaN
1010#
10111/2:-inf:inf
10121/2:-3:8
10131/2:-2:4
1014#1/2:-3/2:2.828427124746190097603377448419396157139
10151/2:-1:2
1016#1/2:-1/2:1.41421356237309504880168872420969807857
10171/2:0:1
1018#1/2:1/2:0.7071067811865475244008443621048490392848
10191/2:1:1/2
1020#1/2:3/2:0.3535533905932737622004221810524245196424
10211/2:2:1/4
10221/2:3:1/8
10231/2:inf:0
10241/2:NaN:NaN
1025#
10261:-inf:1
10271:-3:1
10281:-2:1
10291:-3/2:1
10301:-1:1
10311:-1/2:1
10321:0:1
10331:1/2:1
10341:1:1
10351:3/2:1
10361:2:1
10371:3:1
10381:inf:1
10391:NaN:NaN
1040#
10413/2:-inf:0
10423/2:-3:8/27
10433/2:-2:4/9
1044#3/2:-3/2:0.5443310539518173551549520166013091982147
10453/2:-1:2/3
1046#3/2:-1/2:0.816496580927726032732428024901963797322
10473/2:0:1
1048#3/2:1/2:1.224744871391589049098642037352945695983
10493/2:1:3/2
1050#3/2:3/2:1.837117307087383573647963056029418543974
10513/2:2:9/4
10523/2:3:27/8
10533/2:inf:inf
10543/2:NaN:NaN
1055#
10562:-inf:0
10572:-3:1/8
10582:-2:1/4
1059#2:-3/2:0.3535533905932737622004221810524245196424
10602:-1:1/2
1061#2:-1/2:0.7071067811865475244008443621048490392848
10622:0:1
1063#2:1/2:1.41421356237309504880168872420969807857
10642:1:2
1065#2:3/2:2.828427124746190097603377448419396157139
10662:2:4
10672:3:8
10682:inf:inf
10692:NaN:NaN
1070#
10713:-inf:0
10723:-3:1/27
10733:-2:1/9
1074#3:-3/2:0.1924500897298752548363829268339858185492
10753:-1:1/3
1076#3:-1/2:0.5773502691896257645091487805019574556476
10773:0:1
1078#3:1/2:1.732050807568877293527446341505872366943
10793:1:3
1080#3:3/2:5.196152422706631880582339024517617100828
10813:2:9
10823:3:27
10833:inf:inf
10843:NaN:NaN
1085#
1086inf:-inf:0
1087inf:-3:0
1088inf:-2:0
1089inf:-3/2:0
1090inf:-1:0
1091inf:-1/2:0
1092inf:0:NaN
1093inf:1/2:inf
1094inf:1:inf
1095inf:3/2:inf
1096inf:2:inf
1097inf:3:inf
1098inf:inf:inf
1099inf:NaN:NaN
1100#
1101NaN:-inf:NaN
1102NaN:-3:NaN
1103NaN:-2:NaN
1104NaN:-3/2:NaN
1105NaN:-1:NaN
1106NaN:-1/2:NaN
1107NaN:0:NaN
1108NaN:1/2:NaN
1109NaN:1:NaN
1110NaN:3/2:NaN
1111NaN:2:NaN
1112NaN:3:NaN
1113NaN:inf:NaN
1114NaN:NaN:NaN
1115
1116&bacmp
1117+0:-0:0
1118+0:+1:-1
1119-1:+1:0
1120+1:-1:0
1121-1:+2:-1
1122+2:-1:1
1123-123456789:+987654321:-1
1124+123456789:-987654321:-1
1125+987654321:+123456789:1
1126-987654321:+123456789:1
1127-123:+4567889:-1
1128# NaNs
1129acmpNaN:123:
1130123:acmpNaN:
1131acmpNaN:acmpNaN:
1132# infinity
1133+inf:+inf:0
1134-inf:-inf:0
1135+inf:-inf:0
1136-inf:+inf:0
1137+inf:123:1
1138-inf:123:1
1139+inf:-123:1
1140-inf:-123:1
1141+inf:1/23:1
1142-inf:1/23:1
1143+inf:-1/23:1
1144-inf:-1/23:1
1145+inf:12/3:1
1146-inf:12/3:1
1147+inf:-12/3:1
1148-inf:-12/3:1
1149123:inf:-1
1150-123:inf:-1
1151123:-inf:-1
1152-123:-inf:-1
11531/23:inf:-1
1154-1/23:inf:-1
11551/23:-inf:-1
1156-1/23:-inf:-1
115712/3:inf:-1
1158-12/3:inf:-1
115912/3:-inf:-1
1160-12/3:-inf:-1
1161# return undef
1162+inf:NaN:
1163NaN:inf:
1164-inf:NaN:
1165NaN:-inf:
11661/3:2/3:-1
11672/3:1/3:1
11682/3:2/3:0
1169
1170&numerator
1171NaN:NaN
1172inf:inf
1173-inf:-inf
11743/7:3
1175-3/7:-3
11760:0
11771:1
11785/-3:-5
1179
1180&denominator
1181NaN:NaN
1182inf:1
1183-inf:1
11843/7:7
11850:1
11861/1:1
1187-1/1:1
1188-3/7:7
11894/-5:5
1190
1191&finc
11923/2:5/2
1193-15/6:-3/2
1194NaN:NaN
1195-1/3:2/3
1196-2/7:5/7
1197
1198&fdec
119915/6:3/2
1200-3/2:-5/2
12011/3:-2/3
12022/7:-5/7
1203NaN:NaN
1204
1205&log
1206-1:NaN
12070:-inf
12081:0
120934803:3267955896544848894312057422508991/312500000000000000000000000000000
1210-inf:inf
1211inf:inf
1212NaN:NaN
1213
1214&exp
1215
1216&sin
1217
1218&cos
1219
1220&atan2
1221
1222&int
1223
1224&abs
1225
1226&sqrt
1227