1 #include this file into another test for subclass testing...
3 ok ($class->config()->{lib},$CL);
11 $_ =~ s/[\n\r]//g; # remove newlines
12 $_ =~ s/#.*$//; # remove comments
13 $_ =~ s/\s+$//; # trailing spaces
14 next if /^$/; # skip empty lines & comments
21 $setup = $_; $setup =~ s/\$/\$${class}::/g; # round_mode, div_scale
22 #print "\$setup== $setup\n";
29 @args = split(/:/,$1,99);
33 @args = split(/:/,$_,99); $ans = pop(@args);
35 $try = "\$x = $class->new(\"$args[0]\");";
39 } elsif ($f eq "finf") {
40 $try .= "\$x->finf('$args[1]');";
41 } elsif ($f eq "is_inf") {
42 $try .= "\$x->is_inf('$args[1]');";
43 } elsif ($f eq "fone") {
44 $try .= "\$x->bone('$args[1]');";
45 } elsif ($f eq "fstr") {
46 $try .= "\$x->accuracy($args[1]); \$x->precision($args[2]);";
47 $try .= '$x->fstr();';
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();';
52 } elsif ($f eq "exponent") {
53 # ->bstr() to see if an object is returned
54 $try .= '$x->exponent()->bstr();';
55 } elsif ($f eq "mantissa") {
56 # ->bstr() to see if an object is returned
57 $try .= '$x->mantissa()->bstr();';
58 } elsif ($f =~ /^(numify|length|as_number|as_hex|as_bin)$/) {
60 # some unary ops (test the fxxx form, since that is done by AUTOLOAD)
61 } elsif ($f =~ /^f(nan|sstr|neg|floor|ceil|abs)$/) {
62 $try .= "\$x->f$1();";
63 # some is_xxx test function
64 } elsif ($f =~ /^is_(zero|one|negative|positive|odd|even|nan|int)$/) {
66 } elsif ($f eq "bpi") {
67 $try .= '$class->bpi($x);';
68 } elsif ($f eq "finc") {
70 } elsif ($f eq "fdec") {
72 }elsif ($f eq "fround") {
73 $try .= "$setup; \$x->fround($args[1]);";
74 } elsif ($f eq "ffround") {
75 $try .= "$setup; \$x->ffround($args[1]);";
76 } elsif ($f eq "fsqrt") {
77 $try .= "$setup; \$x->fsqrt();";
78 } elsif ($f eq "ffac") {
79 $try .= "$setup; \$x->ffac();";
80 } elsif ($f eq "flog") {
81 if (defined $args[1] && $args[1] ne '')
83 $try .= "\$y = $class->new($args[1]);";
84 $try .= "$setup; \$x->flog(\$y);";
88 $try .= "$setup; \$x->flog();";
93 $try .= "\$y = $class->new(\"$args[1]\");";
99 $try .= " \$z = $class->new(\"$args[2]\"); ";
101 $try .= "$class\::bgcd(\$x, \$y";
102 $try .= ", \$z" if (defined $args[2]);
107 if (defined $args[2])
109 $try .= " \$z = $class->new(\"$args[2]\"); ";
111 $try .= "$class\::blcm(\$x, \$y";
112 $try .= ", \$z" if (defined $args[2]);
114 } elsif ($f eq "fcmp") {
115 $try .= '$x->fcmp($y);';
116 } elsif ($f eq "facmp") {
117 $try .= '$x->facmp($y);';
118 } elsif ($f eq "fpow") {
120 } elsif ($f eq "bnok") {
121 $try .= '$x->bnok($y);';
122 } elsif ($f eq "bcos") {
123 $try .= '$x->bcos($y);';
124 } elsif ($f eq "bsin") {
125 $try .= '$x->bsin($y);';
126 } elsif ($f eq "batan") {
127 $try .= '$x->batan($y);';
128 } elsif ($f eq "froot") {
129 $try .= "$setup; \$x->froot(\$y);";
130 } elsif ($f eq "fadd") {
132 } elsif ($f eq "fsub") {
134 } elsif ($f eq "fmul") {
136 } elsif ($f eq "fdiv") {
137 $try .= "$setup; \$x / \$y;";
138 } elsif ($f eq "fdiv-list") {
139 $try .= "$setup; join(',',\$x->fdiv(\$y));";
140 } elsif ($f eq "frsft") {
142 } elsif ($f eq "flsft") {
144 } elsif ($f eq "fmod") {
147 # Functions with three arguments
148 $try .= "\$z = $class->new(\"$args[2]\");";
150 if( $f eq "bmodpow") {
151 $try .= '$x->bmodpow($y,$z);';
152 } elsif ($f eq "bmuladd"){
153 $try .= '$x->bmuladd($y,$z);';
154 } elsif ($f eq "batan2"){
155 $try .= '$x->batan2($y,$z);';
156 } else { warn "Unknown op '$f'"; }
159 # print "# Trying: '$try'\n";
161 print "# Error: $@\n" if $@;
162 if ($ans =~ m|^/(.*)$|)
171 print "# '$try' expected: /$pat/ got: '$ans1'\n" if !ok(1,0);
182 print "# Tried: '$try'\n" if !ok ($ans1, $ans);
183 if (ref($ans1) eq "$class")
185 # float numbers are normalized (for now), so mantissa shouldn't have
187 #print $ans1->_trailing_zeros(),"\n";
188 print "# Has trailing zeros after '$try'\n"
189 if !ok ($CL->_zeros( $ans1->{_m}), 0);
192 } # end pattern or string
196 # check whether $class->new( Math::BigInt->new()) destroys it
197 # ($y == 12 in this case)
198 $x = Math::BigInt->new(1200); $y = $class->new($x);
199 ok ($y,1200); ok ($x,1200);
201 ###############################################################################
202 # Really huge, big, ultra-mega-biggy-monster exponents
203 # Technically, the exponents should not be limited (they are BigInts), but
204 # practically there are a few places were they are limited to a Perl scalar.
205 # This is sometimes for speed, sometimes because otherwise the number wouldn't
206 # fit into your memory (just think of 1e123456789012345678901234567890 + 1!)
207 # anyway. We don't test everything here, but let's make sure it just basically
210 my $monster = '1e1234567890123456789012345678901234567890';
213 ok ($class->new($monster)->bsstr(),
214 '1e+1234567890123456789012345678901234567890');
215 ok ($class->new($monster)->exponent(),
216 '1234567890123456789012345678901234567890');
218 ok ($class->new($monster) > 0,1);
221 ok ($class->new($monster)->bsub( $monster),0);
222 ok ($class->new($monster)->bmul(2)->bsstr(),
223 '2e+1234567890123456789012345678901234567890');
226 $monster = '1234567890123456789012345678901234567890e2';
227 ok ($class->new($monster)->mantissa(),
228 '123456789012345678901234567890123456789');
230 ###############################################################################
233 $x = $class->new(2); $x->fzero(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
234 $x = $class->new(2); $x->finf(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
235 $x = $class->new(2); $x->fone(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
236 $x = $class->new(2); $x->fnan(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
238 ###############################################################################
239 # bone/binf etc as plain calls (Lite failed them)
241 ok ($class->fzero(),0);
242 ok ($class->fone(),1);
243 ok ($class->fone('+'),1);
244 ok ($class->fone('-'),-1);
245 ok ($class->fnan(),'NaN');
246 ok ($class->finf(),'inf');
247 ok ($class->finf('+'),'inf');
248 ok ($class->finf('-'),'-inf');
249 ok ($class->finf('-inf'),'-inf');
251 $class->accuracy(undef); $class->precision(undef); # reset
253 ###############################################################################
254 # bug in bsstr()/numify() showed up in after-rounding in bdiv()
256 $x = $class->new('0.008'); $y = $class->new(2);
260 ###############################################################################
261 # fsqrt() with set global A/P or A/P enabled on $x, also a test whether fsqrt()
262 # correctly modifies $x
265 $x = $class->new(12); $class->precision(-2); $x->fsqrt(); ok ($x,'3.46');
267 $class->precision(undef);
268 $x = $class->new(12); $class->precision(0); $x->fsqrt(); ok ($x,'3');
270 $class->precision(-3); $x = $class->new(12); $x->fsqrt(); ok ($x,'3.464');
275 ${${class}.'::accuracy'} = 4; $x = $class->new(12);
276 $x->fsqrt(3); ok ($x,'NaN');
277 # supplied arg overrides set global
278 $class->precision(undef); $x = $class->new(12); $x->fsqrt(3); ok ($x,'3.46');
279 $class->accuracy(undef); $class->precision(undef); # reset for further tests
282 #############################################################################
283 # can we call objectify (broken until v1.52)
288 '@args' . " = $class" . "::objectify(2,$class,4,5);".'join(" ",@args);';
290 ok ($ans,"$class 4 5");
293 #############################################################################
294 # is_one('-') (broken until v1.64)
296 ok ($class->new(-1)->is_one(),0);
297 ok ($class->new(-1)->is_one('-'),1);
299 #############################################################################
300 # bug 1/0.5 leaving 2e-0 instead of 2e0
302 ok ($class->new(1)->fdiv('0.5')->bsstr(),'2e+0');
304 ###############################################################################
305 # [perl #30609] bug with $x -= $x not being 0, but 2*$x
307 $x = $class->new(3); $x -= $x; ok ($x, 0);
308 $x = $class->new(-3); $x -= $x; ok ($x, 0);
309 $x = $class->new(3); $x += $x; ok ($x, 6);
310 $x = $class->new(-3); $x += $x; ok ($x, -6);
312 $x = $class->new('NaN'); $x -= $x; ok ($x->is_nan(), 1);
313 $x = $class->new('inf'); $x -= $x; ok ($x->is_nan(), 1);
314 $x = $class->new('-inf'); $x -= $x; ok ($x->is_nan(), 1);
316 $x = $class->new('NaN'); $x += $x; ok ($x->is_nan(), 1);
317 $x = $class->new('inf'); $x += $x; ok ($x->is_inf(), 1);
318 $x = $class->new('-inf'); $x += $x; ok ($x->is_inf('-'), 1);
320 $x = $class->new('3.14'); $x -= $x; ok ($x, 0);
321 $x = $class->new('-3.14'); $x -= $x; ok ($x, 0);
322 $x = $class->new('3.14'); $x += $x; ok ($x, '6.28');
323 $x = $class->new('-3.14'); $x += $x; ok ($x, '-6.28');
325 $x = $class->new('3.14'); $x *= $x; ok ($x, '9.8596');
326 $x = $class->new('-3.14'); $x *= $x; ok ($x, '9.8596');
327 $x = $class->new('3.14'); $x /= $x; ok ($x, '1');
328 $x = $class->new('-3.14'); $x /= $x; ok ($x, '1');
329 $x = $class->new('3.14'); $x %= $x; ok ($x, '0');
330 $x = $class->new('-3.14'); $x %= $x; ok ($x, '0');
332 ###############################################################################
333 # the following two were reported by "kenny" via hotmail.com:
335 #perl -MMath::BigFloat -wle 'print Math::BigFloat->new(0)->bpow(".1")'
336 #Use of uninitialized value in numeric le (<=) at BigFloat.pm line 1851.
338 $x = $class->new(0); $y = $class->new('0.1');
339 ok ($x ** $y, 0, 'no warnings and zero result');
341 #perl -MMath::BigFloat -lwe 'print Math::BigFloat->new(".222222222222222222222222222222222222222222")->bceil()'
342 #Use of uninitialized value in numeric le (<=) at BigFloat.pm line 1851.
344 $x = $class->new(".222222222222222222222222222222222222222222");
345 ok ($x->bceil(), 1, 'no warnings and one as result');
347 ###############################################################################
351 $x = $class->new(2); $x **= 148; $x++; $x->bdiv(17, 60)->bfloor(); $x->accuracy(undef);
352 ok ($x,"20988936657440586486151264256610222593863921");
353 ok ($x->length(),length "20988936657440586486151264256610222593863921");
355 $x = $class->new('2');
356 my $y = $class->new('18');
357 ok ($x <<= $y, 2 << 18);
362 $x = $class->new('2');
363 $y = $class->new('18.2');
364 $x <<= $y; # 2 * (2 ** 18.2);
366 ok ($x->copy()->bfround(-9), '602248.763144685');
367 ok ($x >>= $y, 2); # 2 * (2 ** 18.2) / (2 ** 18.2) => 2
372 ###############################################################################
373 # Perl 5.005 does not like ok ($x,undef)
379 ok (1,1) and return if !defined $x;
423 2.4:12:-0.737393715541
432 2.1:12:0.863209366649
433 1.2:13:0.9320390859672
434 0.2:13:0.1986693307951
435 3.2:12:-0.0583741434276
438 inf:14:1.5707963267949
439 -inf:14:-1.5707963267949
440 0.2:13:0.1973955598499
441 0.2:14:0.19739555984988
443 1:14:0.78539816339744
444 -1:14:-0.78539816339744
445 # test an argument X > 1
451 inf:1:14:1.5707963267949
452 -inf:1:14:-1.5707963267949
453 0:-inf:14:3.1415926535898
454 -1:-inf:14:-3.1415926535898
455 1:-inf:14:3.1415926535898
457 inf:-inf:14:2.3561944901923
458 -inf:-inf:14:-2.3561944901923
459 inf:+inf:14:0.7853981633974
460 -inf:+inf:14:-0.7853981633974
461 1:5:13:0.1973955598499
462 1:5:14:0.19739555984988
466 1:0:14:1.5707963267949
467 5:0:14:1.5707963267949
468 -1:0:11:-1.5707963268
469 -2:0:77:-1.5707963267948966192313216916397514420985846996875529104874722961539082031431
470 2:0:77:1.5707963267948966192313216916397514420985846996875529104874722961539082031431
471 -1:5:14:-0.19739555984988
472 1:5:14:0.19739555984988
473 -1:8:14:-0.12435499454676
474 1:8:14:0.12435499454676
475 -1:1:14:-0.78539816339744
476 # test an argument X > 1 and one X < 1
477 1:2:24:0.463647609000806116214256
478 2:1:14:1.1071487177941
479 -2:1:14:-1.1071487177941
481 150:3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940813
482 77:3.1415926535897932384626433832795028841971693993751058209749445923078164062862
483 +0:3.141592653589793238462643383279502884197
499 100:90:17310309456440
504 # base > 0, base != 1
508 # log(1) is always 1, regardless of $base
512 2::0.6931471805599453094172321214581765680755
513 2.718281828::0.9999999998311266953289851340574956564911
515 2.718281828::0.99999999983112669533
517 123::4.81218435537242
519 1000::6.90775527898214
520 100::4.60517018598809
522 3.1415::1.14470039286086
523 12345::9.42100640177928
524 0.001::-6.90775527898214
528 # reset for further tests
563 # some inputs that result in zero
597 # test for bug in brsft() not handling cases that return 0
642 # uses bsstr() so 5 => 5e+0 to be compatible w/ Perls output
679 1234.567:9::1234.56700
680 1234.567::-6:1234.567000
682 0.001234:6::0.00123400
683 0.001234::-8:0.00123400
706 000000_0000000_00000:0
717 -123456789:-123456789
725 -.0000000004:-0.0000000004
740 -3e111:-3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
741 -4e-1111:-0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004
760 123.456:2:15241.383936
763 128:-2:0.00006103515625
778 # 2 ** 0.5 == sqrt(2)
779 # 1.41..7 and not 1.4170 since fallback (bsqrt(9) is '3', not 3.0...0)
780 2:0.5:1.41421356237309504880168872420969807857
781 #2:0.2:1.148698354997035006798626946777927589444
782 #6:1.5:14.6969384566990685891837044482353483518
784 #62.5:12.5:26447206647554886213592.3959144
793 +123456789:-123456789
795 +123.456789:-123.456789
796 -123456.789:123456.789
806 +123.456789:123.456789
807 -123456.789:123456.789
809 $round_mode = "trunc"
814 +10123456789:5:10123000000
815 -10123456789:5:-10123000000
816 +10123456789.123:5:10123000000
817 -10123456789.123:5:-10123000000
818 +10123456789:9:10123456700
819 -10123456789:9:-10123456700
820 +101234500:6:101234000
821 -101234500:6:-101234000
823 +20123456789:5:20123000000
824 -20123456789:5:-20123000000
825 +20123456789.123:5:20123000000
826 -20123456789.123:5:-20123000000
827 +20123456789:9:20123456800
828 -20123456789:9:-20123456800
829 +201234500:6:201234000
830 -201234500:6:-201234000
832 +30123456789:5:30123000000
833 -30123456789:5:-30123000000
834 +30123456789.123:5:30123000000
835 -30123456789.123:5:-30123000000
836 +30123456789:9:30123456800
837 -30123456789:9:-30123456800
838 +301234500:6:301235000
839 -301234500:6:-301234000
841 +40123456789:5:40123000000
842 -40123456789:5:-40123000000
843 +40123456789.123:5:40123000000
844 -40123456789.123:5:-40123000000
845 +40123456789:9:40123456800
846 -40123456789:9:-40123456800
847 +401234500:6:401234000
848 -401234500:6:-401235000
850 +50123456789:5:50123000000
851 -50123456789:5:-50123000000
852 +50123456789.123:5:50123000000
853 -50123456789.123:5:-50123000000
854 +50123456789:9:50123456800
855 -50123456789:9:-50123456800
856 +501234500:6:501235000
857 -501234500:6:-501235000
859 +60123456789:5:60123000000
860 -60123456789:5:-60123000000
861 +60123456789:9:60123456800
862 -60123456789:9:-60123456800
863 +601234500:6:601234000
864 -601234500:6:-601234000
865 +60123456789.0123:5:60123000000
866 -60123456789.0123:5:-60123000000
867 $round_mode = "common"
868 +60123456789:5:60123000000
869 -60123456789:5:-60123000000
870 +60123456789:6:60123500000
871 -60123456789:6:-60123500000
872 +60123456789:9:60123456800
873 -60123456789:9:-60123456800
874 +601234500:6:601235000
875 -601234500:6:-601235000
876 +601234400:6:601234000
877 -601234400:6:-601234000
878 +601234600:6:601235000
879 -601234600:6:-601235000
880 +601234300:6:601234000
881 +60123456789.0123:5:60123000000
882 -60123456789.0123:5:-60123000000
884 $round_mode = "trunc"
905 -0.0061234567890:-1:0.0
913 -0.0065:-3:/-0\.006|-6e-03
914 -0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
915 -0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
921 +2.23:-1:/2.2(?:0{5}\d+)?
922 -2.23:-1:/-2.2(?:0{5}\d+)?
923 +2.27:-1:/2.(?:3|29{5}\d+)
924 -2.27:-1:/-2.(?:3|29{5}\d+)
925 +2.25:-1:/2.2(?:0{5}\d+)?
926 -2.25:-1:/-2.2(?:0{5}\d+)?
927 +2.35:-1:/2.(?:3|29{5}\d+)
928 -2.35:-1:/-2.(?:3|29{5}\d+)
930 -0.0065:-2:/-0\.01|-1e-02
931 -0.0065:-3:/-0\.006|-6e-03
932 -0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
933 -0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
939 +3.23:-1:/3.2(?:0{5}\d+)?
940 -3.23:-1:/-3.2(?:0{5}\d+)?
941 +3.27:-1:/3.(?:3|29{5}\d+)
942 -3.27:-1:/-3.(?:3|29{5}\d+)
943 +3.25:-1:/3.(?:3|29{5}\d+)
944 -3.25:-1:/-3.2(?:0{5}\d+)?
945 +3.35:-1:/3.(?:4|39{5}\d+)
946 -3.35:-1:/-3.(?:3|29{5}\d+)
948 -0.0065:-2:/-0\.01|-1e-02
949 -0.0065:-3:/-0\.006|-6e-03
950 -0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
951 -0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
957 +4.23:-1:/4.2(?:0{5}\d+)?
958 -4.23:-1:/-4.2(?:0{5}\d+)?
959 +4.27:-1:/4.(?:3|29{5}\d+)
960 -4.27:-1:/-4.(?:3|29{5}\d+)
961 +4.25:-1:/4.2(?:0{5}\d+)?
962 -4.25:-1:/-4.(?:3|29{5}\d+)
963 +4.35:-1:/4.(?:3|29{5}\d+)
964 -4.35:-1:/-4.(?:4|39{5}\d+)
966 -0.0065:-2:/-0\.01|-1e-02
967 -0.0065:-3:/-0\.007|-7e-03
968 -0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
969 -0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
975 +5.23:-1:/5.2(?:0{5}\d+)?
976 -5.23:-1:/-5.2(?:0{5}\d+)?
977 +5.27:-1:/5.(?:3|29{5}\d+)
978 -5.27:-1:/-5.(?:3|29{5}\d+)
979 +5.25:-1:/5.(?:3|29{5}\d+)
980 -5.25:-1:/-5.(?:3|29{5}\d+)
981 +5.35:-1:/5.(?:3|29{5}\d+)
982 -5.35:-1:/-5.(?:3|29{5}\d+)
984 -0.0065:-2:/-0\.01|-1e-02
985 -0.0065:-3:/-0\.007|-7e-03
986 -0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
987 -0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
993 +6.23:-1:/6.2(?:0{5}\d+)?
994 -6.23:-1:/-6.2(?:0{5}\d+)?
995 +6.27:-1:/6.(?:3|29{5}\d+)
996 -6.27:-1:/-6.(?:3|29{5}\d+)
997 +6.25:-1:/6.(?:2(?:0{5}\d+)?|29{5}\d+)
998 -6.25:-1:/-6.(?:2(?:0{5}\d+)?|29{5}\d+)
999 +6.35:-1:/6.(?:4|39{5}\d+|29{8}\d+)
1000 -6.35:-1:/-6.(?:4|39{5}\d+|29{8}\d+)
1002 -0.0065:-2:/-0\.01|-1e-02
1003 -0.0065:-3:/-0\.006|-7e-03
1004 -0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
1005 -0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03
1011 0.01234567:-4:0.0123
1012 0.01234567:-5:0.01235
1013 0.01234567:-6:0.012346
1014 0.01234567:-7:0.0123457
1015 0.01234567:-8:0.01234567
1016 0.01234567:-9:0.012345670
1017 0.01234567:-12:0.012345670000
1062 0.00000123:0.0005:-1
1077 -inf:-54321.12345:-1
1132 0.00000123:0.0005:-1
1218 +9999999:+1:10000000
1219 +99999999:+1:100000000
1220 +999999999:+1:1000000000
1221 +9999999999:+1:10000000000
1222 +99999999999:+1:100000000000
1229 +10000000:-1:9999999
1230 +100000000:-1:99999999
1231 +1000000000:-1:999999999
1232 +10000000000:-1:9999999999
1233 +123456789:+987654321:1111111110
1234 -123456789:+987654321:864197532
1235 -123456789:-987654321:-1111111110
1236 +123456789:-987654321:-864197532
1237 0.001234:0.0001234:0.0013574
1266 +99999999:+1:99999998
1267 +999999999:+1:999999998
1268 +9999999999:+1:9999999998
1269 +99999999999:+1:99999999998
1276 +10000000:-1:10000001
1277 +100000000:-1:100000001
1278 +1000000000:-1:1000000001
1279 +10000000000:-1:10000000001
1280 +123456789:+987654321:-864197532
1281 -123456789:+987654321:-1111111110
1282 -123456789:-987654321:864197532
1283 +123456789:-987654321:1111111110
1302 123456789123456789:0:0:0
1303 0:123456789123456789:0:0
1314 10101:10101:0:102030201
1315 1001001:1001001:0:1002003002001
1316 100010001:100010001:0:10002000300020001
1317 10000100001:10000100001:0:100002000030000200001
1318 11111111111:9:0:99999999999
1319 22222222222:9:0:199999999998
1320 33333333333:9:0:299999999997
1321 44444444444:9:0:399999999996
1322 55555555555:9:0:499999999995
1323 66666666666:9:0:599999999994
1324 77777777777:9:0:699999999993
1325 88888888888:9:0:799999999992
1326 99999999999:9:0:899999999991
1327 11111111111:9:1:100000000000
1328 22222222222:9:1:199999999999
1329 33333333333:9:1:299999999998
1330 44444444444:9:1:399999999997
1331 55555555555:9:1:499999999996
1332 66666666666:9:1:599999999995
1333 77777777777:9:1:699999999994
1334 88888888888:9:1:799999999993
1335 99999999999:9:1:899999999992
1342 9999999999999999999:10000000000000000000:1234567890:99999999999999999990000000001234567890
1344 -3.2:5.197:6.05:-10.5804
1349 77777:777:123456789:99995084
1350 3.2:6.2:5.2:2.970579856718063040273642739529400818
1376 +123456789123456789:+0:0
1377 +0:+123456789123456789:0
1387 +10101:+10101:102030201
1388 +1001001:+1001001:1002003002001
1389 +100010001:+100010001:10002000300020001
1390 +10000100001:+10000100001:100002000030000200001
1391 +11111111111:+9:99999999999
1392 +22222222222:+9:199999999998
1393 +33333333333:+9:299999999997
1394 +44444444444:+9:399999999996
1395 +55555555555:+9:499999999995
1396 +66666666666:+9:599999999994
1397 +77777777777:+9:699999999993
1398 +88888888888:+9:799999999992
1399 +99999999999:+9:899999999991
1407 # bug in v1.74 with bdiv in list context, when $y is 1 or -1
1413 $div_scale = 40; $round_mode = 'even'
1439 +999999999999:+9:111111111111
1440 +999999999999:+99:10101010101
1441 +999999999999:+999:1001001001
1442 +999999999999:+9999:100010001
1443 +999999999999999:+99999:10000100001
1444 +1000000000:+9:111111111.1111111111111111111111111111111
1445 +2000000000:+9:222222222.2222222222222222222222222222222
1446 +3000000000:+9:333333333.3333333333333333333333333333333
1447 +4000000000:+9:444444444.4444444444444444444444444444444
1448 +5000000000:+9:555555555.5555555555555555555555555555556
1449 +6000000000:+9:666666666.6666666666666666666666666666667
1450 +7000000000:+9:777777777.7777777777777777777777777777778
1451 +8000000000:+9:888888888.8888888888888888888888888888889
1452 +9000000000:+9:1000000000
1453 +35500000:+113:314159.2920353982300884955752212389380531
1454 +71000000:+226:314159.2920353982300884955752212389380531
1455 +106500000:+339:314159.2920353982300884955752212389380531
1456 +1000000000:+3:333333333.3333333333333333333333333333333
1457 2:25.024996000799840031993601279744051189762:0.07992009269196593320152084692285869265447
1460 +1000000000:+9:111111111.11111111111
1461 +2000000000:+9:222222222.22222222222
1462 +3000000000:+9:333333333.33333333333
1463 +4000000000:+9:444444444.44444444444
1464 +5000000000:+9:555555555.55555555556
1465 +6000000000:+9:666666666.66666666667
1466 +7000000000:+9:777777777.77777777778
1467 +8000000000:+9:888888888.88888888889
1468 +9000000000:+9:1000000000
1473 1:504:0.001984126984126984127
1474 2:1.987654321:1.0062111801179738436
1475 123456789.123456789123456789123456789:1:123456789.12345678912
1476 # the next two cases are the "old" behaviour, but are now (>v0.01) different
1477 #+35500000:+113:314159.292035398230088
1478 #+71000000:+226:314159.292035398230088
1479 +35500000:+113:314159.29203539823009
1480 +71000000:+226:314159.29203539823009
1481 +106500000:+339:314159.29203539823009
1482 +1000000000:+3:333333333.33333333333
1484 # round to accuracy 1 after bdiv
1486 123456789.1234:1:100000000
1487 # reset scale for further tests
1494 # inf handling, see table in doc
1513 # exceptions to reminder rule
1552 999999999999999:99999:0
1566 152403346:12345:4321
1568 # now some floating point tests
1601 # -$x ** (1/2) => -$y, but not in froot()
1605 2:2:1.41421356237309504880168872420969807857
1611 123.456:2:11.11107555549866648462149404118219234119
1612 15241.38393:2:123.4559999756998444766131352122991626468
1614 12:2:3.464101615137754587054892683011744733886
1645 # see t/bigroot() for more tests
1656 2:1.41421356237309504880168872420969807857
1661 123.456:11.11107555549866648462149404118219234119
1662 15241.38393:123.4559999756998444766131352122991626468
1664 # sqrt(1.44) = 1.2, sqrt(e10) = e5 => 12e4
1666 2e10:141421.356237309504880168872420969807857
1668 # proved to be an endless loop under 7-9
1669 12:3.464101615137754587054892683011744733886
1688 # it must be exactly /^[+-]inf$/
1784 12345678901234567890:20