1#include this file into another test for subclass testing... 2 3use strict; 4use warnings; 5 6our ($CLASS, $LIB); 7 8is($CLASS->config('lib'), $LIB, "$CLASS->config('lib')"); 9 10my ($x, $y, $z, @args, $try, $want, $got); 11my ($f, $setup); 12 13while (<DATA>) { 14 s/#.*$//; # remove comments 15 s/\s+$//; # remove trailing whitespace 16 next unless length; # skip empty lines 17 18 if (s/^&//) { 19 $f = $_; 20 next; 21 } 22 23 if (/^\$/) { 24 $setup = $_; 25 $setup =~ s/\$/\$${CLASS}::/g; # round_mode, div_scale 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 .= qq| \$x;|; 40 } elsif ($f =~ /^is_(zero|one|odd|even||(non_)?(negative|positive)|nan|int)$/) { 41 $try .= qq| \$x->$f();|; 42 } elsif ($f eq "is_inf") { 43 $try .= qq| \$x->is_inf("$args[1]");|; 44 } elsif ($f eq "binf") { 45 $try .= qq| \$x->binf("$args[1]");|; 46 } elsif ($f eq "bone") { 47 $try .= length($args[1]) ? qq| \$x->bone("$args[1]");| 48 : qq| \$x->bone();|; 49 } elsif ($f eq "bstr") { 50 $try .= qq| \$x->accuracy($args[1]); \$x->precision($args[2]);|; 51 $try .= ' $x->bstr();'; 52 # some unary ops 53 } elsif ($f =~ /^b(nan|floor|ceil|int|sstr|neg|abs|sgn|inc|dec|not|sqrt|exp)$/) { 54 $try .= qq| \$x->$f();|; 55 } elsif ($f =~ /^b[dt]?fac$/) { 56 $try .= qq| \$x->$f();|; 57 } elsif ($f =~ /^(numify|length|as_number)$/) { 58 $try .= qq| \$x->$f();|; 59 } elsif ($f =~ /^(to|as)_(hex|oct|bin)$/) { 60 $try .= " \$x->$f();"; 61 # overloaded functions 62 } elsif ($f =~ /^(log|exp|sin|cos|atan2|int|neg|abs|sqrt)$/) { 63 $try .= qq| \$x = $f(\$x);|; 64 } elsif ($f eq "parts") { 65 # ->bstr() to see if an object is returned 66 $try .= ' ($a, $b) = $x->parts(); $a = $a->bstr(); $b = $b->bstr();'; 67 $try .= ' "$a $b";'; 68 } elsif ($f eq "exponent") { 69 # ->bstr() to see if an object is returned 70 $try .= ' $x->exponent()->bstr();'; 71 } elsif ($f eq "mantissa") { 72 # ->bstr() to see if an object is returned 73 $try .= ' $x->mantissa()->bstr();'; 74 } elsif ($f eq "bpi") { 75 $try .= qq| $CLASS->bpi(\$x);|; 76 } elsif ($f eq "bround") { 77 $try .= qq| $setup; \$x->bround($args[1]);|; 78 } elsif ($f eq "bfround") { 79 $try .= qq| $setup; \$x->bfround($args[1]);|; 80 } elsif ($f eq "bsqrt") { 81 $try .= qq| $setup; \$x->bsqrt();|; 82 } elsif ($f eq "bfac") { 83 $try .= qq| $setup; \$x->bfac();|; 84 } elsif ($f eq "bdfac") { 85 $try .= qq| $setup; \$x->bdfac();|; 86 } elsif ($f eq "blog") { 87 if (defined $args[1] && $args[1] ne '') { 88 $try .= qq| \$y = $CLASS->new($args[1]);|; 89 $try .= qq| $setup; \$x->blog(\$y);|; 90 } else { 91 $try .= qq| $setup; \$x->blog();|; 92 } 93 } else { 94 # binary operators 95 $try .= qq| \$y = $CLASS->new("$args[1]");|; 96 97 if ($f eq "bgcd") { 98 if (defined $args[2]) { 99 $try .= qq| \$z = $CLASS->new("$args[2]");|; 100 } 101 $try .= qq| $CLASS\::bgcd(\$x, \$y|; 102 $try .= qq|, \$z| if defined $args[2]; 103 $try .= qq|);|; 104 } elsif ($f eq "blcm") { 105 if (defined $args[2]) { 106 $try .= qq| \$z = $CLASS->new("$args[2]");|; 107 } 108 $try .= qq| $CLASS\::blcm(\$x, \$y|; 109 $try .= qq|, \$z| if defined $args[2]; 110 $try .= qq|);|; 111 } elsif ($f eq "bcmp") { 112 $try .= ' $x->bcmp($y);'; 113 } elsif ($f eq "bacmp") { 114 $try .= ' $x->bacmp($y);'; 115 } elsif ($f eq "bpow") { 116 $try .= ' $x->bpow($y);'; 117 } elsif ($f eq "bnok") { 118 $try .= ' $x->bnok($y);'; 119 } elsif ($f eq "bmfac") { 120 $try .= ' $x->bmfac($y);'; 121 } elsif ($f eq "bcos") { 122 $try .= ' $x->bcos($y);'; 123 } elsif ($f eq "bsin") { 124 $try .= ' $x->bsin($y);'; 125 } elsif ($f eq "batan") { 126 $try .= ' $x->batan($y);'; 127 } elsif ($f eq "broot") { 128 $try .= qq| $setup; \$x->broot(\$y);|; 129 } elsif ($f eq "badd") { 130 $try .= ' $x->badd($y);'; 131 } elsif ($f eq "bsub") { 132 $try .= ' $x->bsub($y);'; 133 } elsif ($f eq "bmul") { 134 $try .= ' $x->bmul($y);'; 135 } elsif ($f eq "bdiv") { 136 $try .= qq| $setup; scalar \$x->bdiv(\$y);|; 137 } elsif ($f eq "bdiv-list") { 138 $try .= qq| $setup; join(",", \$x->bdiv(\$y));|; 139 } elsif ($f eq "brsft") { 140 $try .= ' $x->brsft($y);'; 141 } elsif ($f eq "blsft") { 142 $try .= ' $x->blsft($y);'; 143 } elsif ($f eq "bmod") { 144 $try .= ' $x->bmod($y);'; 145 } else { 146 # Functions with three arguments 147 $try .= qq| \$z = $CLASS->new("$args[2]");|; 148 149 if ($f eq "bmodpow") { 150 $try .= ' $x->bmodpow($y, $z);'; 151 } elsif ($f eq "bmuladd") { 152 $try .= ' $x->bmuladd($y, $z);'; 153 } elsif ($f eq "batan2") { 154 $try .= ' $x->batan2($y, $z);'; 155 } else { 156 warn qq|Unknown op "$f"|; 157 } 158 } 159 } 160 161 $got = eval $try; 162 print "# Error: $@\n" if $@; 163 164 if ($want =~ m|^/(.*)$|) { 165 my $pat = $1; 166 like($got, qr/$pat/, $try); 167 } else { 168 if ($want eq "") { 169 is($got, undef, $try); 170 } else { 171 is($got, $want, $try); 172 if (ref($got) eq $CLASS) { 173 # float numbers are normalized (for now), so mantissa shouldn't 174 # have trailing zeros print $got->_trailing_zeros(), "\n"; 175 is($LIB->_zeros($got->{_m}), 0, $try); 176 } 177 } 178 } # end pattern or string 179 180} # end while 181 182# check whether $CLASS->new(Math::BigInt->new()) destroys it 183# ($y == 12 in this case) 184$x = Math::BigInt->new(1200); 185$y = $CLASS->new($x); 186is($y, 1200, 187 qq|\$x = Math::BigInt->new(1200); \$y = $CLASS->new(\$x); # check \$y|); 188is($x, 1200, 189 qq|\$x = Math::BigInt->new(1200); \$y = $CLASS->new(\$x); # check \$x|); 190 191############################################################################### 192# Really huge, big, ultra-mega-biggy-monster exponents. Technically, the 193# exponents should not be limited (they are Math::BigInt objects), but 194# practically there are a few places were they are limited to a Perl scalar. 195# This is sometimes for speed, sometimes because otherwise the number wouldn't 196# fit into your memory (just think of 1e123456789012345678901234567890 + 1!) 197# anyway. We don't test everything here, but let's make sure it just basically 198# works. 199 200my $monster = '1e1234567890123456789012345678901234567890'; 201 202# new and exponent 203is($CLASS->new($monster)->bsstr(), 204 '1e+1234567890123456789012345678901234567890', 205 qq|$CLASS->new("$monster")->bsstr()|); 206is($CLASS->new($monster)->exponent(), 207 '1234567890123456789012345678901234567890', 208 qq|$CLASS->new("$monster")->exponent()|); 209 210# cmp 211is($CLASS->new($monster) > 0, 1, qq|$CLASS->new("$monster") > 0|); 212 213# sub/mul 214is($CLASS->new($monster)->bsub($monster), 0, 215 qq|$CLASS->new("$monster")->bsub("$monster")|); 216is($CLASS->new($monster)->bmul(2)->bsstr(), 217 '2e+1234567890123456789012345678901234567890', 218 qq|$CLASS->new("$monster")->bmul(2)->bsstr()|); 219 220# mantissa 221$monster = '1234567890123456789012345678901234567890e2'; 222is($CLASS->new($monster)->mantissa(), 223 '123456789012345678901234567890123456789', 224 qq|$CLASS->new("$monster")->mantissa()|); 225 226############################################################################### 227# zero, inf, one, nan 228 229$x = $CLASS->new(2); 230$x->bzero(); 231is($x->{_a}, undef, qq|\$x = $CLASS->new(2); \$x->bzero(); \$x->{_a}|); 232is($x->{_p}, undef, qq|\$x = $CLASS->new(2); \$x->bzero(); \$x->{_p}|); 233 234$x = $CLASS->new(2); 235$x->binf(); 236is($x->{_a}, undef, qq|\$x = $CLASS->new(2); \$x->binf(); \$x->{_a}|); 237is($x->{_p}, undef, qq|\$x = $CLASS->new(2); \$x->binf(); \$x->{_p}|); 238 239$x = $CLASS->new(2); 240$x->bone(); 241is($x->{_a}, undef, qq|\$x = $CLASS->new(2); \$x->bone(); \$x->{_a}|); 242is($x->{_p}, undef, qq|\$x = $CLASS->new(2); \$x->bone(); \$x->{_p}|); 243 244$x = $CLASS->new(2); 245$x->bnan(); 246is($x->{_a}, undef, qq|\$x = $CLASS->new(2); \$x->bnan(); \$x->{_a}|); 247is($x->{_p}, undef, qq|\$x = $CLASS->new(2); \$x->bnan(); \$x->{_p}|); 248 249############################################################################### 250# bone/binf etc as plain calls (Lite failed them) 251 252is($CLASS->bzero(), 0, qq|$CLASS->bzero()|); 253is($CLASS->bone(), 1, qq|$CLASS->bone()|); 254is($CLASS->bone("+"), 1, qq|$CLASS->bone("+")|); 255is($CLASS->bone("-"), -1, qq|$CLASS->bone("-")|); 256is($CLASS->bnan(), "NaN", qq|$CLASS->bnan()|); 257is($CLASS->binf(), "inf", qq|$CLASS->binf()|); 258is($CLASS->binf("+"), "inf", qq|$CLASS->binf("+")|); 259is($CLASS->binf("-"), "-inf", qq|$CLASS->binf("-")|); 260is($CLASS->binf("-inf"), "-inf", qq|$CLASS->binf("-inf")|); 261 262$CLASS->accuracy(undef); # reset 263$CLASS->precision(undef); # reset 264 265############################################################################### 266# bsqrt() with set global A/P or A/P enabled on $x, also a test whether bsqrt() 267# correctly modifies $x 268 269$x = $CLASS->new(12); 270$CLASS->precision(-2); 271$x->bsqrt(); 272is($x, '3.46', 273 qq|\$x = $CLASS->new(12); $CLASS->precision(-2); \$x->bsqrt();|); 274 275$CLASS->precision(undef); 276$x = $CLASS->new(12); 277$CLASS->precision(0); 278$x->bsqrt(); 279is($x, '3', 280 qq|$CLASS->precision(undef); \$x = $CLASS->new(12);| . 281 qq| $CLASS->precision(0); \$x->bsqrt();|); 282 283$CLASS->precision(-3); 284$x = $CLASS->new(12); 285$x->bsqrt(); 286is($x, '3.464', 287 qq|$CLASS->precision(-3); \$x = $CLASS->new(12); \$x->bsqrt();|); 288 289{ 290 no strict 'refs'; 291 # A and P set => NaN 292 ${${CLASS}.'::accuracy'} = 4; 293 $x = $CLASS->new(12); 294 $x->bsqrt(3); 295 is($x, 'NaN', "A and P set => NaN"); 296 297 # supplied arg overrides set global 298 $CLASS->precision(undef); 299 $x = $CLASS->new(12); 300 $x->bsqrt(3); 301 is($x, '3.46', "supplied arg overrides set global"); 302 303 # reset for further tests 304 $CLASS->accuracy(undef); 305 $CLASS->precision(undef); 306} 307 308############################################################################# 309# can we call objectify (broken until v1.52) 310 311{ 312 no strict; 313 $try = '@args' 314 . " = $CLASS" 315 . "::objectify(2, $CLASS, 4, 5);" 316 . ' join(" ", @args);'; 317 $want = eval $try; 318 is($want, "$CLASS 4 5", $try); 319} 320 321############################################################################# 322# is_one('-') (broken until v1.64) 323 324is($CLASS->new(-1)->is_one(), 0, qq|$CLASS->new(-1)->is_one()|); 325is($CLASS->new(-1)->is_one("-"), 1, qq|$CLASS->new(-1)->is_one("-")|); 326 327############################################################################# 328# bug 1/0.5 leaving 2e-0 instead of 2e0 329 330is($CLASS->new(1)->bdiv("0.5")->bsstr(), "2e+0", 331 qq|$CLASS->new(1)->bdiv("0.5")->bsstr()|); 332 333############################################################################### 334# [perl #30609] bug with $x -= $x not being 0, but 2*$x 335 336$x = $CLASS->new(3); 337$x -= $x; 338is($x, 0, qq|\$x = $CLASS->new(3); \$x -= \$x;|); 339 340$x = $CLASS->new(-3); 341$x -= $x; 342is($x, 0, qq|\$x = $CLASS->new(-3); \$x -= \$x;|); 343 344$x = $CLASS->new(3); 345$x += $x; 346is($x, 6, qq|\$x = $CLASS->new(3); \$x += \$x;|); 347 348$x = $CLASS->new(-3); 349$x += $x; 350is($x, -6, qq|\$x = $CLASS->new(-3); \$x += \$x;|); 351 352$x = $CLASS->new("NaN"); 353$x -= $x; 354is($x->is_nan(), 1, qq|\$x = $CLASS->new("NaN"); \$x -= \$x;|); 355 356$x = $CLASS->new("inf"); 357$x -= $x; 358is($x->is_nan(), 1, qq|\$x = $CLASS->new("inf"); \$x -= \$x;|); 359 360$x = $CLASS->new("-inf"); 361$x -= $x; 362is($x->is_nan(), 1, qq|\$x = $CLASS->new("-inf"); \$x -= \$x;|); 363 364$x = $CLASS->new("NaN"); 365$x += $x; 366is($x->is_nan(), 1, qq|\$x = $CLASS->new("NaN"); \$x += \$x;|); 367 368$x = $CLASS->new("inf"); 369$x += $x; 370is($x->is_inf(), 1, qq|\$x = $CLASS->new("inf"); \$x += \$x;|); 371 372$x = $CLASS->new("-inf"); 373$x += $x; 374is($x->is_inf("-"), 1, qq|\$x = $CLASS->new("-inf"); \$x += \$x;|); 375 376$x = $CLASS->new("3.14"); 377$x -= $x; 378is($x, 0, qq|\$x = $CLASS->new("3.14"); \$x -= \$x;|); 379 380$x = $CLASS->new("-3.14"); 381$x -= $x; 382is($x, 0, qq|\$x = $CLASS->new("-3.14"); \$x -= \$x;|); 383 384$x = $CLASS->new("3.14"); 385$x += $x; 386is($x, "6.28", qq|$x = $CLASS->new("3.14"); $x += $x;|); 387 388$x = $CLASS->new("-3.14"); 389$x += $x; 390is($x, "-6.28", qq|$x = $CLASS->new("-3.14"); $x += $x;|); 391 392$x = $CLASS->new("3.14"); 393$x *= $x; 394is($x, "9.8596", qq|$x = $CLASS->new("3.14"); $x *= $x;|); 395 396$x = $CLASS->new("-3.14"); 397$x *= $x; 398is($x, "9.8596", qq|$x = $CLASS->new("-3.14"); $x *= $x;|); 399 400$x = $CLASS->new("3.14"); 401$x /= $x; 402is($x, "1", qq|$x = $CLASS->new("3.14"); $x /= $x;|); 403 404$x = $CLASS->new("-3.14"); 405$x /= $x; 406is($x, "1", qq|$x = $CLASS->new("-3.14"); $x /= $x;|); 407 408$x = $CLASS->new("3.14"); 409$x %= $x; 410is($x, "0", qq|$x = $CLASS->new("3.14"); $x %= $x;|); 411 412$x = $CLASS->new("-3.14"); 413$x %= $x; 414is($x, "0", qq|$x = $CLASS->new("-3.14"); $x %= $x;|); 415 416############################################################################### 417# the following two were reported by "kenny" via hotmail.com: 418 419#perl -MMath::BigFloat -wle 'print Math::BigFloat->new(0)->bpow(".1")' 420#Use of uninitialized value in numeric le (<=) at BigFloat.pm line 1851. 421 422$x = $CLASS->new(0); 423$y = $CLASS->new("0.1"); 424is($x ** $y, 0, 425 qq|\$x = $CLASS->new(0); \$y = $CLASS->new("0.1"); \$x ** \$y|); 426 427#perl -MMath::BigFloat -lwe 'print Math::BigFloat->new(".222222222222222222222222222222222222222222")->bceil()' 428#Use of uninitialized value in numeric le (<=) at BigFloat.pm line 1851. 429 430$x = $CLASS->new(".222222222222222222222222222222222222222222"); 431is($x->bceil(), 1, 432 qq|$x = $CLASS->new(".222222222222222222222222222222222222222222");| . 433 qq| $x->bceil();|); 434 435############################################################################### 436# test **=, <<=, >>= 437 438# ((2**148)+1)/17 439$x = $CLASS->new(2); 440$x **= 148; 441$x++; 442$x->bdiv(17, 60)->bfloor(); 443$x->accuracy(undef); 444is($x, "20988936657440586486151264256610222593863921", 445 "value of ((2**148)+1)/17"); 446is($x->length(), length("20988936657440586486151264256610222593863921"), 447 "number of digits in ((2**148)+1)/17"); 448 449$x = $CLASS->new("2"); 450$y = $CLASS->new("18"); 451is($x <<= $y, 2 << 18, 452 qq|\$x = $CLASS->new("2"); \$y = $CLASS->new("18");| 453 . q| $x <<= $y|); 454is($x, 2 << 18, 455 qq|\$x = $CLASS->new("2"); \$y = $CLASS->new("18");| 456 . q| $x <<= $y; $x|); 457is($x >>= $y, 2, 458 qq|\$x = $CLASS->new("2"); \$y = $CLASS->new("18");| 459 . q| $x <<= $y; $x >>= $y|); 460is($x, 2, 461 qq|\$x = $CLASS->new("2"); \$y = $CLASS->new("18");| 462 . q| $x <<= $y; $x >>= $y; $x|); 463 464$x = $CLASS->new("2"); 465$y = $CLASS->new("18.2"); 466 467# 2 * (2 ** int(18.2)); 468$x <<= $y; 469is($x->copy()->bfround(-9), "602248.763144685", 470 qq|\$x = $CLASS->new("2"); \$y = $CLASS->new("18.2");| . 471 q| $x <<= $y; $x->copy()->bfround(-9);|); 472 473# 2 * (2 ** 18.2) / (2 ** 18.2) => 2 474is($x >>= $y, 2, 475 qq|\$x = $CLASS->new("2"); \$y = $CLASS->new("18.2");| . 476 q| $x <<= $y; $x->copy()->bfround(-9); $x >>= $y|); 477is($x, 2, 478 qq|\$x = $CLASS->new("2"); \$y = $CLASS->new("18.2");| . 479 q| $x <<= $y; $x->copy()->bfround(-9); $x >>= $y; $x|); 480 481__DATA__ 482 483&bgcd 484inf:12:NaN 485-inf:12:NaN 48612:inf:NaN 48712:-inf:NaN 488inf:inf:NaN 489inf:-inf:NaN 490-inf:-inf:NaN 491abc:abc:NaN 492abc:+0:NaN 493+0:abc:NaN 494+0:+0:0 495+0:+1:1 496+1:+0:1 497+1:+1:1 498+2:+3:1 499+3:+2:1 500-3:+2:1 501-3:-2:1 502-144:-60:12 503144:-60:12 504144:60:12 505100:625:25 5064096:81:1 5071034:804:2 50827:90:56:1 50927:90:54:9 510 511&blcm 512abc:abc:NaN 513abc:+0:NaN 514+0:abc:NaN 515+0:+0:NaN 516+1:+0:0 517+0:+1:0 518+27:+90:270 519+1034:+804:415668 520$div_scale = 40 521 522&bcos 523NaN:10:NaN 524+inf:10:NaN 525-inf:10:NaN 5261.2:10:0.3623577545 5272.4:12:-0.737393715541 5280:10:1.000000000 5290:20:1.0000000000000000000 5301:10:0.5403023059 5311:12:0.540302305868 532 533&bsin 534NaN:10:NaN 535+inf:10:NaN 536-inf:10:NaN 5371:10:0.8414709848 5380:10:0 5390:20:0 5402.1:12:0.863209366649 5411.2:13:0.9320390859672 5420.2:13:0.1986693307951 5433.2:12:-0.0583741434276 544 545&batan 546NaN:10:NaN 547inf:14:1.5707963267949 548-inf:14:-1.5707963267949 5490:14:0 5500:10:0 5510.1:14:0.099668652491162 5520.2:13:0.1973955598499 5530.2:14:0.19739555984988 5540.5:14:0.46364760900081 5551:14:0.78539816339744 556-1:14:-0.78539816339744 5571.5:14:0.98279372324732 5582.0:14:1.1071487177941 5592.5:14:1.1902899496825 5603.0:14:1.2490457723982 5616.0:14:1.4056476493803 56212:14:1.4876550949064 56324:14:1.5291537476963 56448:14:1.5499660067587 565 566&batan2 567 568NaN:1:10:NaN 569NaN:NaN:10:NaN 5701:NaN:10:NaN 571 572-inf:-inf:14:-2.3561944901923 573-inf:-1:14:-1.5707963267949 574-inf:0:14:-1.5707963267949 575-inf:+1:14:-1.5707963267949 576-inf:+inf:14:-0.78539816339745 577 578-1:-inf:14:-3.1415926535898 579-1:-1:14:-2.3561944901923 580-1:0:14:-1.5707963267949 581-1:+1:14:-0.78539816339745 582-1:+inf:14:0 583 5840:-inf:14:3.1415926535898 5850:-1:14:3.1415926535898 5860:0:14:0 5870:+1:14:0 5880:+inf:14:0 589 590+1:-inf:14:3.1415926535898 591+1:-1:14:2.3561944901923 592+1:0:14:1.5707963267949 593+1:+1:14:0.78539816339745 594+1:+inf:14:0 595 596+inf:-inf:14:2.3561944901923 597+inf:-1:14:1.5707963267949 598+inf:0:14:1.5707963267949 599+inf:+1:14:1.5707963267949 600+inf:+inf:14:0.78539816339745 601 6021:5:13:0.1973955598499 6031:5:14:0.19739555984988 6040:2:14:0 6055:0:14:1.5707963267949 606-1:0:11:-1.5707963268 607-2:0:77:-1.5707963267948966192313216916397514420985846996875529104874722961539082031431 6082:0:77:1.5707963267948966192313216916397514420985846996875529104874722961539082031431 609-1:5:14:-0.19739555984988 6101:5:14:0.19739555984988 611-1:8:14:-0.12435499454676 6121:8:14:0.12435499454676 613# test an argument X > 1 and one X < 1 6141:2:24:0.463647609000806116214256 6152:1:14:1.1071487177941 616-2:1:14:-1.1071487177941 617 618&bpi 619150:3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940813 62077:3.1415926535897932384626433832795028841971693993751058209749445923078164062862 621+0:3.141592653589793238462643383279502884197 62211:3.1415926536 623 624&bnok 625+inf:10:inf 626NaN:NaN:NaN 627NaN:1:NaN 6281:NaN:NaN 6291:1:1 630# k > n 6311:2:0 6322:3:0 633# k < 0 6341:-2:0 635# 7 over 3 = 35 6367:3:35 6377:6:7 638100:90:17310309456440 639100:95:75287520 6402:0:1 6417:0:1 6422:1:2 643 644&blog 6450::-inf 646-1::NaN 647-2::NaN 648# base > 0, base != 1 6492:-1:NaN 6502:0:0 6512:1:NaN 652# log(1) 6531::0 6541:1:NaN 6551:2:0 6562::0.6931471805599453094172321214581765680755 6572.718281828::0.9999999998311266953289851340574956564911 658$div_scale = 20 6592.718281828::0.99999999983112669533 660$div_scale = 15 661123::4.81218435537242 66210::2.30258509299405 6631000::6.90775527898214 664100::4.60517018598809 6652::0.693147180559945 6663.1415::1.14470039286086 66712345::9.42100640177928 6680.001::-6.90775527898214 669# bug until v1.71: 67010:10:1 671100:100:1 672# reset for further tests 673$div_scale = 40 6741::0 675 676&brsft 677invalid:2:NaN 6780:2:0 6791:1:0.5 6802:1:1 6814:1:2 682123:1:61.5 68332:3:4 684 685&blsft 686invalid:0:NaN 6872:1:4 6884:3:32 6895:3:40 6901:2:4 6910:5:0 692 693&bnorm 6941:1 695-0:0 696invalid:NaN 697+inf:inf 698-inf:-inf 699123:123 700-123.4567:-123.4567 701# invalid inputs 702.2E-3.:NaN 7031e3e4:NaN 704# strange, but valid 705.2E2:20 7061.E3:1000 707# some inputs that result in zero 7080e0:0 709+0e0:0 710+0e+0:0 711-0e+0:0 7120e-0:0 713-0e-0:0 714+0e-0:0 715000:0 71600e2:0 71700e02:0 718000e002:0 719000e1230:0 72000e-3:0 72100e+3:0 72200e-03:0 72300e+03:0 724-000:0 725-00e2:0 726-00e02:0 727-000e002:0 728-000e1230:0 729-00e-3:0 730-00e+3:0 731-00e-03:0 732-00e+03:0 733 734&as_number 7350:0 7361:1 7371.2:1 7382.345:2 739-2:-2 740-123.456:-123 741-200:-200 742-inf:-inf 743inf:inf 744NaN:NaN 74571243225429896467497217836789578596379:71243225429896467497217836789578596379 746# test for bug in brsft() not handling cases that return 0 7470.000641:0 7480.0006412:0 7490.00064123:0 7500.000641234:0 7510.0006412345:0 7520.00064123456:0 7530.000641234567:0 7540.0006412345678:0 7550.00064123456789:0 7560.1:0 7570.01:0 7580.001:0 7590.0001:0 7600.00001:0 7610.000001:0 7620.0000001:0 7630.00000001:0 7640.000000001:0 7650.0000000001:0 7660.00000000001:0 7670.12345:0 7680.123456:0 7690.1234567:0 7700.12345678:0 7710.123456789:0 772 773&binf 7741:+:inf 7752:-:-inf 7763:abc:inf 777 778&as_hex 779128:0x80 780-128:-0x80 7810:0x0 782-0:0x0 7831:0x1 7840x123456789123456789:0x123456789123456789 785+inf:inf 786-inf:-inf 787invalid:NaN 788 789&as_bin 790128:0b10000000 791-128:-0b10000000 7920:0b0 793-0:0b0 7941:0b1 7950b1010111101010101010110110110110110101:0b1010111101010101010110110110110110101 7960x123456789123456789:0b100100011010001010110011110001001000100100011010001010110011110001001 797+inf:inf 798-inf:-inf 799invalid:NaN 800 801&as_oct 802128:0200 803-128:-0200 8040:00 805-0:00 8061:01 8070b1010111101010101010110110110110110101:01275252666665 8080x123456789123456789:044321263611044321263611 809+inf:inf 810-inf:-inf 811invalid:NaN 812 813&to_hex 814128:80 815-128:-80 8160:0 817-0:0 8181:1 8190x123456789123456789:123456789123456789 820+inf:inf 821-inf:-inf 822invalid:NaN 823 824&to_bin 825128:10000000 826-128:-10000000 8270:0 828-0:0 8291:1 8300b1010111101010101010110110110110110101:1010111101010101010110110110110110101 8310x123456789123456789:100100011010001010110011110001001000100100011010001010110011110001001 832+inf:inf 833-inf:-inf 834invalid:NaN 835 836&to_oct 837128:200 838-128:-200 8390:0 840-0:0 8411:1 8420b1010111101010101010110110110110110101:1275252666665 8430x123456789123456789:44321263611044321263611 844+inf:inf 845-inf:-inf 846invalid:NaN 847 848&numify 849# uses bsstr() so 5 => 5e+0 to be compatible w/ Perls output 8500:0 851+1:1 8521234:1234 853-5:-5 854100:100 855-100:-100 856 857&bnan 858abc:NaN 8592:NaN 860-2:NaN 8610:NaN 862 863&bone 8642:+:1 865-2:-:-1 866-2:+:1 8672:-:-1 8680::1 869-2::1 870abc::1 8712::1 872 873&bsstr 874+inf:inf 875-inf:-inf 876abcfsstr:NaN 877-abcfsstr:NaN 8781234.567:1234567e-3 879123:123e+0 880-5:-5e+0 881-100:-1e+2 882 883&bstr 884+inf:::inf 885-inf:::-inf 886abcfstr:::NaN 8871234.567:9::1234.56700 8881234.567::-6:1234.567000 88912345:5::12345 8900.001234:6::0.00123400 8910.001234::-8:0.00123400 8920:4::0 8930::-4:0.0000 894 895&bnorm 896inf:inf 897+inf:inf 898-inf:-inf 899+infinity:inf 900+-inf:NaN 901abc:NaN 902 1 a:NaN 9031bcd2:NaN 90411111b:NaN 905+1z:NaN 906-1z:NaN 9070e999:0 9080e-999:0 909-0e999:0 910-0e-999:0 9110:0 912+0:0 913+00:0 914+0_0_0:0 915000000_0000000_00000:0 916-0:0 917-0000:0 918+1:1 919+01:1 920+001:1 921+00000100000:100000 922123456789:123456789 923-1:-1 924-01:-1 925-001:-1 926-123456789:-123456789 927-00000100000:-100000 928123.456a:NaN 929123.456:123.456 9300.01:0.01 931.002:0.002 932+.2:0.2 933-0.0003:-0.0003 934-.0000000004:-0.0000000004 935123456E2:12345600 936123456E-2:1234.56 937-123456E2:-12345600 938-123456E-2:-1234.56 9391e1:10 9402e-11:0.00000000002 941# exercise _split 942 .02e-1:0.002 943 000001:1 944 -00001:-1 945 -1:-1 946 000.01:0.01 947 -000.0023:-0.0023 948 1.1e1:11 949-3e111:-3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 950-4e-1111:-0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004 951 952&bpow 953# 954abc:123.456:NaN 955123.456:abc:NaN 956# 957-inf:-inf:0 958-inf:-3:0 959-inf:-2:0 960-inf:-1.5:0 961-inf:-1:0 962-inf:-0.5:0 963-inf:0:NaN 964-inf:0.5:inf # directed infinity 965-inf:1:-inf 966-inf:1.5:inf # directed infinity 967-inf:2:inf 968-inf:3:-inf 969-inf:inf:inf # complex infinity 970-inf:NaN:NaN 971# 972-3:-inf:0 973-3:-3:-0.03703703703703703703703703703703703703704 974-3:-2:0.1111111111111111111111111111111111111111 975-3:-1.5:NaN 976-3:-1:-0.3333333333333333333333333333333333333333 977-3:-0.5:NaN 978-3:0:1 979-3:0.5:NaN 980-3:1:-3 981-3:1.5:NaN 982-3:2:9 983-3:3:-27 984-3:inf:inf # complex infinity 985-3:NaN:NaN 986# 987-2:-inf:0 988-2:-3:-0.125 989-2:-2:0.25 990-2:-1.5:NaN 991-2:-1:-0.5 992-2:-0.5:NaN 993-2:0:1 994-2:0.5:NaN 995-2:1:-2 996-2:1.5:NaN 997-2:2:4 998-2:3:-8 999-2:inf:inf # complex infinity 1000-2:NaN:NaN 1001# 1002-1.5:-inf:0 1003-1.5:-3:-0.2962962962962962962962962962962962962963 1004-1.5:-2:0.4444444444444444444444444444444444444444 1005-1.5:-1.5:NaN 1006-1.5:-1:-0.6666666666666666666666666666666666666667 1007-1.5:-0.5:NaN 1008-1.5:0:1 1009-1.5:0.5:NaN 1010-1.5:1:-1.5 1011-1.5:1.5:NaN 1012-1.5:2:2.25 1013-1.5:3:-3.375 1014-1.5:inf:inf # complex infinity 1015-1.5:NaN:NaN 1016# 1017-1:-inf:NaN 1018-1:-3:-1 1019-1:-2:1 1020-1:-1.5:NaN 1021-1:-1:-1 1022-1:-0.5:NaN 1023-1:0:1 1024-1:0.5:NaN 1025-1:1:-1 1026-1:1.5:NaN 1027-1:2:1 1028-1:3:-1 1029-1:inf:NaN 1030-1:NaN:NaN 1031# 1032-0.5:-inf:inf # complex infinity 1033-0.5:-3:-8 1034-0.5:-2:4 1035-0.5:-1.5:NaN 1036-0.5:-1:-2 1037-0.5:-0.5:NaN 1038-0.5:0:1 1039-0.5:0.5:NaN 1040-0.5:1:-0.5 1041-0.5:1.5:NaN 1042-0.5:2:0.25 1043-0.5:3:-0.125 1044-0.5:inf:0 1045-0.5:NaN:NaN 1046# 10470:-inf:inf # complex infinity 10480:-3:inf # complex infinity 10490:-2:inf # complex infinity 10500:-1.5:inf # complex infinity 10510:-1:inf # complex infinity 10520:-0.5:inf # complex infinity 10530:0:1 10540:0.5:0 10550:1:0 10560:1.5:0 10570:2:0 10580:3:0 10590:inf:0 10600:NaN:NaN 1061# 10620.5:-inf:inf 10630.5:-3:8 10640.5:-2:4 10650.5:-1.5:2.828427124746190097603377448419396157139 10660.5:-1:2 10670.5:-0.5:1.41421356237309504880168872420969807857 10680.5:0:1 10690.5:0.5:0.7071067811865475244008443621048490392848 10700.5:1:0.5 10710.5:1.5:0.3535533905932737622004221810524245196424 10720.5:2:0.25 10730.5:3:0.125 10740.5:inf:0 10750.5:NaN:NaN 1076# 10771:-inf:1 10781:-3:1 10791:-2:1 10801:-1.5:1 10811:-1:1 10821:-0.5:1 10831:0:1 10841:0.5:1 10851:1:1 10861:1.5:1 10871:2:1 10881:3:1 10891:inf:1 10901:NaN:NaN 1091# 10921.5:-inf:0 10931.5:-3:0.2962962962962962962962962962962962962963 10941.5:-2:0.4444444444444444444444444444444444444444 10951.5:-1.5:0.5443310539518173551549520166013091982147 10961.5:-1:0.6666666666666666666666666666666666666667 10971.5:-0.5:0.816496580927726032732428024901963797322 10981.5:0:1 10991.5:0.5:1.224744871391589049098642037352945695983 11001.5:1:1.5 11011.5:1.5:1.837117307087383573647963056029418543974 11021.5:2:2.25 11031.5:3:3.375 11041.5:inf:inf 11051.5:NaN:NaN 1106# 11072:-inf:0 11082:-3:0.125 11092:-2:0.25 11102:-1.5:0.3535533905932737622004221810524245196424 11112:-1:0.5 11122:-0.5:0.7071067811865475244008443621048490392848 11132:0:1 11142:0.5:1.41421356237309504880168872420969807857 11152:1:2 11162:1.5:2.828427124746190097603377448419396157139 11172:2:4 11182:3:8 11192:inf:inf 11202:NaN:NaN 1121# 11223:-inf:0 11233:-3:0.03703703703703703703703703703703703703704 11243:-2:0.1111111111111111111111111111111111111111 11253:-1.5:0.1924500897298752548363829268339858185492 11263:-1:0.3333333333333333333333333333333333333333 11273:-0.5:0.5773502691896257645091487805019574556476 11283:0:1 11293:0.5:1.732050807568877293527446341505872366943 11303:1:3 11313:1.5:5.196152422706631880582339024517617100828 11323:2:9 11333:3:27 11343:inf:inf 11353:NaN:NaN 1136# 1137inf:-inf:0 1138inf:-3:0 1139inf:-2:0 1140inf:-1.5:0 1141inf:-1:0 1142inf:-0.5:0 1143inf:0:NaN 1144inf:0.5:inf 1145inf:1:inf 1146inf:1.5:inf 1147inf:2:inf 1148inf:3:inf 1149inf:inf:inf 1150inf:NaN:NaN 1151# 1152NaN:-inf:NaN 1153NaN:-3:NaN 1154NaN:-2:NaN 1155NaN:-1.5:NaN 1156NaN:-1:NaN 1157NaN:-0.5:NaN 1158NaN:0:NaN 1159NaN:0.5:NaN 1160NaN:1:NaN 1161NaN:1.5:NaN 1162NaN:2:NaN 1163NaN:3:NaN 1164NaN:inf:NaN 1165NaN:NaN:NaN 1166# 1167123.456:2:15241.383936 1168128:-2:0.00006103515625 1169# 1170+inf:123.45:inf 1171-inf:123.45:inf # directed infinity 1172+inf:-123.45:0 1173-inf:-123.45:0 1174#2:0.2:1.148698354997035006798626946777927589444 1175#6:1.5:14.6969384566990685891837044482353483518 1176$div_scale = 20 1177#62.5:12.5:26447206647554886213592.3959144 1178$div_scale = 40 1179 1180&bneg 1181invalid:NaN 1182+inf:-inf 1183-inf:inf 1184+0:0 1185+1:-1 1186-1:1 1187+123456789:-123456789 1188-123456789:123456789 1189+123.456789:-123.456789 1190-123456.789:123456.789 1191 1192&babs 1193invalid:NaN 1194+inf:inf 1195-inf:inf 1196+0:0 1197+1:1 1198-1:1 1199+123456789:123456789 1200-123456789:123456789 1201+123.456789:123.456789 1202-123456.789:123456.789 1203 1204&bround 1205$round_mode = "trunc" 1206+inf:5:inf 1207-inf:5:-inf 12080:5:0 1209invalid:5:NaN 1210+10123456789:5:10123000000 1211-10123456789:5:-10123000000 1212+10123456789.123:5:10123000000 1213-10123456789.123:5:-10123000000 1214+10123456789:9:10123456700 1215-10123456789:9:-10123456700 1216+101234500:6:101234000 1217-101234500:6:-101234000 1218$round_mode = "zero" 1219+20123456789:5:20123000000 1220-20123456789:5:-20123000000 1221+20123456789.123:5:20123000000 1222-20123456789.123:5:-20123000000 1223+20123456789:9:20123456800 1224-20123456789:9:-20123456800 1225+201234500:6:201234000 1226-201234500:6:-201234000 1227$round_mode = "+inf" 1228+30123456789:5:30123000000 1229-30123456789:5:-30123000000 1230+30123456789.123:5:30123000000 1231-30123456789.123:5:-30123000000 1232+30123456789:9:30123456800 1233-30123456789:9:-30123456800 1234+301234500:6:301235000 1235-301234500:6:-301234000 1236$round_mode = "-inf" 1237+40123456789:5:40123000000 1238-40123456789:5:-40123000000 1239+40123456789.123:5:40123000000 1240-40123456789.123:5:-40123000000 1241+40123456789:9:40123456800 1242-40123456789:9:-40123456800 1243+401234500:6:401234000 1244-401234500:6:-401235000 1245$round_mode = "odd" 1246+50123456789:5:50123000000 1247-50123456789:5:-50123000000 1248+50123456789.123:5:50123000000 1249-50123456789.123:5:-50123000000 1250+50123456789:9:50123456800 1251-50123456789:9:-50123456800 1252+501234500:6:501235000 1253-501234500:6:-501235000 1254$round_mode = "even" 1255+60123456789:5:60123000000 1256-60123456789:5:-60123000000 1257+60123456789:9:60123456800 1258-60123456789:9:-60123456800 1259+601234500:6:601234000 1260-601234500:6:-601234000 1261+60123456789.0123:5:60123000000 1262-60123456789.0123:5:-60123000000 1263$round_mode = "common" 1264+60123456789:5:60123000000 1265-60123456789:5:-60123000000 1266+60123456789:6:60123500000 1267-60123456789:6:-60123500000 1268+60123456789:9:60123456800 1269-60123456789:9:-60123456800 1270+601234500:6:601235000 1271-601234500:6:-601235000 1272+601234400:6:601234000 1273-601234400:6:-601234000 1274+601234600:6:601235000 1275-601234600:6:-601235000 1276+601234300:6:601234000 1277+60123456789.0123:5:60123000000 1278-60123456789.0123:5:-60123000000 1279 1280&bfround 1281$round_mode = "trunc" 1282+inf:5:inf 1283-inf:5:-inf 12840:5:0 1285invalid:5:NaN 1286+1.23:-1:1.2 1287+1.234:-1:1.2 1288+1.2345:-1:1.2 1289+1.23:-2:1.23 1290+1.234:-2:1.23 1291+1.2345:-2:1.23 1292+1.23:-3:1.230 1293+1.234:-3:1.234 1294+1.2345:-3:1.234 1295-1.23:-1:-1.2 1296+1.27:-1:1.2 1297-1.27:-1:-1.2 1298+1.25:-1:1.2 1299-1.25:-1:-1.2 1300+1.35:-1:1.3 1301-1.35:-1:-1.3 1302-0.0061234567890:-1:0.0 1303-0.0061:-1:0.0 1304-0.00612:-1:0.0 1305-0.00612:-2:0.00 1306-0.006:-1:0.0 1307-0.006:-2:0.00 1308-0.0006:-2:0.00 1309-0.0006:-3:0.000 1310-0.0065:-3:/-0\.006|-6e-03 1311-0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03 1312-0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03 13130.05:0:0 13140.5:0:0 13150.51:0:0 13160.41:0:0 1317$round_mode = "zero" 1318+2.23:-1:/2.2(?:0{5}\d+)? 1319-2.23:-1:/-2.2(?:0{5}\d+)? 1320+2.27:-1:/2.(?:3|29{5}\d+) 1321-2.27:-1:/-2.(?:3|29{5}\d+) 1322+2.25:-1:/2.2(?:0{5}\d+)? 1323-2.25:-1:/-2.2(?:0{5}\d+)? 1324+2.35:-1:/2.(?:3|29{5}\d+) 1325-2.35:-1:/-2.(?:3|29{5}\d+) 1326-0.0065:-1:0.0 1327-0.0065:-2:/-0\.01|-1e-02 1328-0.0065:-3:/-0\.006|-6e-03 1329-0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03 1330-0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03 13310.05:0:0 13320.5:0:0 13330.51:0:1 13340.41:0:0 1335$round_mode = "+inf" 1336+3.23:-1:/3.2(?:0{5}\d+)? 1337-3.23:-1:/-3.2(?:0{5}\d+)? 1338+3.27:-1:/3.(?:3|29{5}\d+) 1339-3.27:-1:/-3.(?:3|29{5}\d+) 1340+3.25:-1:/3.(?:3|29{5}\d+) 1341-3.25:-1:/-3.2(?:0{5}\d+)? 1342+3.35:-1:/3.(?:4|39{5}\d+) 1343-3.35:-1:/-3.(?:3|29{5}\d+) 1344-0.0065:-1:0.0 1345-0.0065:-2:/-0\.01|-1e-02 1346-0.0065:-3:/-0\.006|-6e-03 1347-0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03 1348-0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03 13490.05:0:0 13500.5:0:1 13510.51:0:1 13520.41:0:0 1353$round_mode = "-inf" 1354+4.23:-1:/4.2(?:0{5}\d+)? 1355-4.23:-1:/-4.2(?:0{5}\d+)? 1356+4.27:-1:/4.(?:3|29{5}\d+) 1357-4.27:-1:/-4.(?:3|29{5}\d+) 1358+4.25:-1:/4.2(?:0{5}\d+)? 1359-4.25:-1:/-4.(?:3|29{5}\d+) 1360+4.35:-1:/4.(?:3|29{5}\d+) 1361-4.35:-1:/-4.(?:4|39{5}\d+) 1362-0.0065:-1:0.0 1363-0.0065:-2:/-0\.01|-1e-02 1364-0.0065:-3:/-0\.007|-7e-03 1365-0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03 1366-0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03 13670.05:0:0 13680.5:0:0 13690.51:0:1 13700.41:0:0 1371$round_mode = "odd" 1372+5.23:-1:/5.2(?:0{5}\d+)? 1373-5.23:-1:/-5.2(?:0{5}\d+)? 1374+5.27:-1:/5.(?:3|29{5}\d+) 1375-5.27:-1:/-5.(?:3|29{5}\d+) 1376+5.25:-1:/5.(?:3|29{5}\d+) 1377-5.25:-1:/-5.(?:3|29{5}\d+) 1378+5.35:-1:/5.(?:3|29{5}\d+) 1379-5.35:-1:/-5.(?:3|29{5}\d+) 1380-0.0065:-1:0.0 1381-0.0065:-2:/-0\.01|-1e-02 1382-0.0065:-3:/-0\.007|-7e-03 1383-0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03 1384-0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03 13850.05:0:0 13860.5:0:1 13870.51:0:1 13880.41:0:0 1389$round_mode = "even" 1390+6.23:-1:/6.2(?:0{5}\d+)? 1391-6.23:-1:/-6.2(?:0{5}\d+)? 1392+6.27:-1:/6.(?:3|29{5}\d+) 1393-6.27:-1:/-6.(?:3|29{5}\d+) 1394+6.25:-1:/6.(?:2(?:0{5}\d+)?|29{5}\d+) 1395-6.25:-1:/-6.(?:2(?:0{5}\d+)?|29{5}\d+) 1396+6.35:-1:/6.(?:4|39{5}\d+|29{8}\d+) 1397-6.35:-1:/-6.(?:4|39{5}\d+|29{8}\d+) 1398-0.0065:-1:0.0 1399-0.0065:-2:/-0\.01|-1e-02 1400-0.0065:-3:/-0\.006|-7e-03 1401-0.0065:-4:/-0\.006(?:5|49{5}\d+)|-6\.5e-03 1402-0.0065:-5:/-0\.006(?:5|49{5}\d+)|-6\.5e-03 14030.05:0:0 14040.5:0:0 14050.51:0:1 14060.41:0:0 14070.01234567:-3:0.012 14080.01234567:-4:0.0123 14090.01234567:-5:0.01235 14100.01234567:-6:0.012346 14110.01234567:-7:0.0123457 14120.01234567:-8:0.01234567 14130.01234567:-9:0.012345670 14140.01234567:-12:0.012345670000 1415 1416&bcmp 1417invalid:invalid: 1418invalid:+0: 1419+0:invalid: 1420+0:+0:0 1421-1:+0:-1 1422+0:-1:1 1423+1:+0:1 1424+0:+1:-1 1425-1:+1:-1 1426+1:-1:1 1427-1:-1:0 1428+1:+1:0 1429-1.1:0:-1 1430+0:-1.1:1 1431+1.1:+0:1 1432+0:+1.1:-1 1433+123:+123:0 1434+123:+12:1 1435+12:+123:-1 1436-123:-123:0 1437-123:-12:-1 1438-12:-123:1 1439+123:+124:-1 1440+124:+123:1 1441-123:-124:1 1442-124:-123:-1 14430:0.01:-1 14440:0.0001:-1 14450:-0.0001:1 14460:-0.1:1 14470.1:0:1 14480.00001:0:1 1449-0.0001:0:-1 1450-0.1:0:-1 14510:0.0001234:-1 14520:-0.0001234:1 14530.0001234:0:1 1454-0.0001234:0:-1 14550.0001:0.0005:-1 14560.0005:0.0001:1 14570.005:0.0001:1 14580.001:0.0005:1 14590.000001:0.0005:-1 14600.00000123:0.0005:-1 14610.00512:0.0001:1 14620.005:0.000112:1 14630.00123:0.0005:1 14641.5:2:-1 14652:1.5:1 14661.54321:234:-1 1467234:1.54321:1 14681e1234567890987654321:1e1234567890987654320:1 14691e-1234567890987654321:1e-1234567890987654320:-1 1470# infinity 1471-inf:5432112345:-1 1472+inf:5432112345:1 1473-inf:-5432112345:-1 1474+inf:-5432112345:1 1475-inf:54321.12345:-1 1476+inf:54321.12345:1 1477-inf:-54321.12345:-1 1478+inf:-54321.12345:1 1479+inf:+inf:0 1480-inf:-inf:0 1481+inf:-inf:1 1482-inf:+inf:-1 1483# return undef 1484+inf:NaN: 1485NaN:inf: 1486-inf:NaN: 1487NaN:-inf: 1488 1489&bacmp 1490invalid:invalid: 1491invalid:+0: 1492+0:invalid: 1493+0:+0:0 1494-1:+0:1 1495+0:-1:-1 1496+1:+0:1 1497+0:+1:-1 1498-1:+1:0 1499+1:-1:0 1500-1:-1:0 1501+1:+1:0 1502-1.1:0:1 1503+0:-1.1:-1 1504+1.1:+0:1 1505+0:+1.1:-1 1506+123:+123:0 1507+123:+12:1 1508+12:+123:-1 1509-123:-123:0 1510-123:-12:1 1511-12:-123:-1 1512+123:+124:-1 1513+124:+123:1 1514-123:-124:-1 1515-124:-123:1 15160:0.01:-1 15170:0.0001:-1 15180:-0.0001:-1 15190:-0.1:-1 15200.1:0:1 15210.00001:0:1 1522-0.0001:0:1 1523-0.1:0:1 15240:0.0001234:-1 15250:-0.0001234:-1 15260.0001234:0:1 1527-0.0001234:0:1 15280.0001:0.0005:-1 15290.0005:0.0001:1 15300.005:0.0001:1 15310.001:0.0005:1 15320.000001:0.0005:-1 15330.00000123:0.0005:-1 15340.00512:0.0001:1 15350.005:0.000112:1 15360.00123:0.0005:1 15371.5:2:-1 15382:1.5:1 15391.54321:234:-1 1540234:1.54321:1 1541# infinity 1542-inf:5432112345:1 1543+inf:5432112345:1 1544-inf:-5432112345:1 1545+inf:-5432112345:1 1546-inf:54321.12345:1 1547+inf:54321.12345:1 1548-inf:-54321.12345:1 1549+inf:-54321.12345:1 1550+inf:+inf:0 1551-inf:-inf:0 1552+inf:-inf:0 1553-inf:+inf:0 15545:inf:-1 1555-1:inf:-1 15565:-inf:-1 1557-1:-inf:-1 1558# return undef 1559+inf:invalid: 1560invalid:inf: 1561-inf:invalid: 1562invalid:-inf: 1563 1564&bdec 1565invalid:NaN 1566+inf:inf 1567-inf:-inf 1568+0:-1 1569+1:0 1570-1:-2 15711.23:0.23 1572-1.23:-2.23 1573100:99 1574101:100 1575-100:-101 1576-99:-100 1577-98:-99 157899:98 1579 1580&binc 1581invalid:NaN 1582+inf:inf 1583-inf:-inf 1584+0:1 1585+1:2 1586-1:0 15871.23:2.23 1588-1.23:-0.23 1589100:101 1590-100:-99 1591-99:-98 1592-101:-100 159399:100 1594 1595&badd 1596abc:abc:NaN 1597abc:+0:NaN 1598+0:abc:NaN 1599+inf:-inf:NaN 1600-inf:+inf:NaN 1601+inf:+inf:inf 1602-inf:-inf:-inf 1603invalid:+inf:NaN 1604invalid:+inf:NaN 1605+inf:invalid:NaN 1606-inf:invalid:NaN 1607+0:+0:0 1608+1:+0:1 1609+0:+1:1 1610+1:+1:2 1611-1:+0:-1 1612+0:-1:-1 1613-1:-1:-2 1614-1:+1:0 1615+1:-1:0 1616+9:+1:10 1617+99:+1:100 1618+999:+1:1000 1619+9999:+1:10000 1620+99999:+1:100000 1621+999999:+1:1000000 1622+9999999:+1:10000000 1623+99999999:+1:100000000 1624+999999999:+1:1000000000 1625+9999999999:+1:10000000000 1626+99999999999:+1:100000000000 1627+10:-1:9 1628+100:-1:99 1629+1000:-1:999 1630+10000:-1:9999 1631+100000:-1:99999 1632+1000000:-1:999999 1633+10000000:-1:9999999 1634+100000000:-1:99999999 1635+1000000000:-1:999999999 1636+10000000000:-1:9999999999 1637+123456789:+987654321:1111111110 1638-123456789:+987654321:864197532 1639-123456789:-987654321:-1111111110 1640+123456789:-987654321:-864197532 16410.001234:0.0001234:0.0013574 1642 1643&bsub 1644abc:abc:NaN 1645abc:+0:NaN 1646+0:abc:NaN 1647+inf:-inf:inf 1648-inf:+inf:-inf 1649+inf:+inf:NaN 1650-inf:-inf:NaN 1651invalid:+inf:NaN 1652invalid:+inf:NaN 1653+inf:invalid:NaN 1654-inf:invalid:NaN 1655+0:+0:0 1656+1:+0:1 1657+0:+1:-1 1658+1:+1:0 1659-1:+0:-1 1660+0:-1:1 1661-1:-1:0 1662-1:+1:-2 1663+1:-1:2 1664+9:+1:8 1665+99:+1:98 1666+999:+1:998 1667+9999:+1:9998 1668+99999:+1:99998 1669+999999:+1:999998 1670+9999999:+1:9999998 1671+99999999:+1:99999998 1672+999999999:+1:999999998 1673+9999999999:+1:9999999998 1674+99999999999:+1:99999999998 1675+10:-1:11 1676+100:-1:101 1677+1000:-1:1001 1678+10000:-1:10001 1679+100000:-1:100001 1680+1000000:-1:1000001 1681+10000000:-1:10000001 1682+100000000:-1:100000001 1683+1000000000:-1:1000000001 1684+10000000000:-1:10000000001 1685+123456789:+987654321:-864197532 1686-123456789:+987654321:-1111111110 1687-123456789:-987654321:864197532 1688+123456789:-987654321:1111111110 1689 1690&bmuladd 1691abc:abc:0:NaN 1692abc:+0:0:NaN 1693+0:abc:0:NaN 1694+0:0:abc:NaN 1695invalid:+inf:0:NaN 1696invalid:-inf:0:NaN 1697-inf:invalid:0:NaN 1698+inf:invalid:0:NaN 1699+inf:+inf:0:inf 1700+inf:-inf:0:-inf 1701-inf:+inf:0:-inf 1702-inf:-inf:0:inf 1703+0:+0:0:0 1704+0:+1:0:0 1705+1:+0:0:0 1706+0:-1:0:0 1707-1:+0:0:0 1708123456789123456789:0:0:0 17090:123456789123456789:0:0 1710-1:-1:0:1 1711-1:-1:0:1 1712-1:+1:0:-1 1713+1:-1:0:-1 1714+1:+1:0:1 1715+2:+3:0:6 1716-2:+3:0:-6 1717+2:-3:0:-6 1718-2:-3:0:6 1719111:111:0:12321 172010101:10101:0:102030201 17211001001:1001001:0:1002003002001 1722100010001:100010001:0:10002000300020001 172310000100001:10000100001:0:100002000030000200001 172411111111111:9:0:99999999999 172522222222222:9:0:199999999998 172633333333333:9:0:299999999997 172744444444444:9:0:399999999996 172855555555555:9:0:499999999995 172966666666666:9:0:599999999994 173077777777777:9:0:699999999993 173188888888888:9:0:799999999992 173299999999999:9:0:899999999991 173311111111111:9:1:100000000000 173422222222222:9:1:199999999999 173533333333333:9:1:299999999998 173644444444444:9:1:399999999997 173755555555555:9:1:499999999996 173866666666666:9:1:599999999995 173977777777777:9:1:699999999994 174088888888888:9:1:799999999993 174199999999999:9:1:899999999992 1742-3:-4:-5:7 17433:-4:-5:-17 1744-3:4:-5:-17 17453:4:-5:7 1746-3:4:5:-7 17473:-4:5:-7 17489999999999999999999:10000000000000000000:1234567890:99999999999999999990000000001234567890 17493.2:5.7:8.9:27.14 1750-3.2:5.197:6.05:-10.5804 1751 1752&bmodpow 17533:4:8:1 17543:4:7:4 17553:4:7:4 175677777:777:123456789:99995084 17573.2:6.2:5.2:2.970579856718063040273642739529400818 1758 1759&bmul 1760abc:abc:NaN 1761abc:+0:NaN 1762+0:abc:NaN 1763+inf:invalid:NaN 1764+inf:invalid:NaN 1765invalid:+inf:NaN 1766invalid:-inf:NaN 1767+inf:+inf:inf 1768+inf:-inf:-inf 1769+inf:-inf:-inf 1770+inf:+inf:inf 1771+inf:123.34:inf 1772+inf:-123.34:-inf 1773-inf:123.34:-inf 1774-inf:-123.34:inf 1775123.34:+inf:inf 1776-123.34:+inf:-inf 1777123.34:-inf:-inf 1778-123.34:-inf:inf 1779+0:+0:0 1780+0:+1:0 1781+1:+0:0 1782+0:-1:0 1783-1:+0:0 1784+123456789123456789:+0:0 1785+0:+123456789123456789:0 1786-1:-1:1 1787-1:+1:-1 1788+1:-1:-1 1789+1:+1:1 1790+2:+3:6 1791-2:+3:-6 1792+2:-3:-6 1793-2:-3:6 1794+111:+111:12321 1795+10101:+10101:102030201 1796+1001001:+1001001:1002003002001 1797+100010001:+100010001:10002000300020001 1798+10000100001:+10000100001:100002000030000200001 1799+11111111111:+9:99999999999 1800+22222222222:+9:199999999998 1801+33333333333:+9:299999999997 1802+44444444444:+9:399999999996 1803+55555555555:+9:499999999995 1804+66666666666:+9:599999999994 1805+77777777777:+9:699999999993 1806+88888888888:+9:799999999992 1807+99999999999:+9:899999999991 18086:120:720 180910:10000:100000 1810 1811&bdiv-list 18120:0:NaN,0 18130:1:0,0 18149:4:2,1 18159:5:1,4 1816# bug in v1.74 with bdiv in list context, when $y is 1 or -1 18172.1:-1:-2.1,0 18182.1:1:2.1,0 1819-2.1:-1:2.1,0 1820-2.1:1:-2.1,0 1821 1822&bdiv 1823$div_scale = 40; $round_mode = "even" 1824abc:abc:NaN 1825abc:+1:abc:NaN 1826+1:abc:NaN 1827-1:abc:NaN 18280:abc:NaN 1829+0:+0:NaN 1830+0:+1:0 1831+1:+0:inf 1832+3214:+0:inf 1833+0:-1:0 1834-1:+0:-inf 1835-3214:+0:-inf 1836+1:+1:1 1837-1:-1:1 1838+1:-1:-1 1839-1:+1:-1 1840+1:+2:0.5 1841+2:+1:2 1842123:+inf:0 1843123:-inf:0 1844+10:+5:2 1845+100:+4:25 1846+1000:+8:125 1847+10000:+16:625 1848+10000:-16:-625 1849+999999999999:+9:111111111111 1850+999999999999:+99:10101010101 1851+999999999999:+999:1001001001 1852+999999999999:+9999:100010001 1853+999999999999999:+99999:10000100001 1854+1000000000:+9:111111111.1111111111111111111111111111111 1855+2000000000:+9:222222222.2222222222222222222222222222222 1856+3000000000:+9:333333333.3333333333333333333333333333333 1857+4000000000:+9:444444444.4444444444444444444444444444444 1858+5000000000:+9:555555555.5555555555555555555555555555556 1859+6000000000:+9:666666666.6666666666666666666666666666667 1860+7000000000:+9:777777777.7777777777777777777777777777778 1861+8000000000:+9:888888888.8888888888888888888888888888889 1862+9000000000:+9:1000000000 1863+35500000:+113:314159.2920353982300884955752212389380531 1864+71000000:+226:314159.2920353982300884955752212389380531 1865+106500000:+339:314159.2920353982300884955752212389380531 1866+1000000000:+3:333333333.3333333333333333333333333333333 18672:25.024996000799840031993601279744051189762:0.07992009269196593320152084692285869265447 1868123456:1:123456 1869$div_scale = 20 1870+1000000000:+9:111111111.11111111111 1871+2000000000:+9:222222222.22222222222 1872+3000000000:+9:333333333.33333333333 1873+4000000000:+9:444444444.44444444444 1874+5000000000:+9:555555555.55555555556 1875+6000000000:+9:666666666.66666666667 1876+7000000000:+9:777777777.77777777778 1877+8000000000:+9:888888888.88888888889 1878+9000000000:+9:1000000000 18791:10:0.1 18801:100:0.01 18811:1000:0.001 18821:10000:0.0001 18831:504:0.001984126984126984127 18842:1.987654321:1.0062111801179738436 1885123456789.123456789123456789123456789:1:123456789.12345678912 1886# the next two cases are the "old" behaviour, but are now (>v0.01) different 1887#+35500000:+113:314159.292035398230088 1888#+71000000:+226:314159.292035398230088 1889+35500000:+113:314159.29203539823009 1890+71000000:+226:314159.29203539823009 1891+106500000:+339:314159.29203539823009 1892+1000000000:+3:333333333.33333333333 1893$div_scale = 1 1894# round to accuracy 1 after bdiv 1895+124:+3:40 1896123456789.1234:1:100000000 1897# reset scale for further tests 1898$div_scale = 40 1899 1900&bmod 1901+9:4:1 1902+9:5:4 1903+9000:56:40 1904+56:9000:56 1905# inf handling, see table in doc 19060:inf:0 19070:-inf:0 19085:inf:5 19095:-inf:-inf 1910-5:inf:inf 1911-5:-inf:-5 1912inf:5:NaN 1913-inf:5:NaN 1914inf:-5:NaN 1915-inf:-5:NaN 19165:5:0 1917-5:-5:0 1918inf:inf:NaN 1919-inf:-inf:NaN 1920-inf:inf:NaN 1921inf:-inf:NaN 19228:0:8 1923inf:0:inf 1924-inf:0:-inf 1925-8:0:-8 19260:0:0 1927abc:abc:NaN 1928abc:1:abc:NaN 19291:abc:NaN 19300:1:0 19311:0:1 19320:-1:0 1933-1:0:-1 19341:1:0 1935-1:-1:0 19361:-1:0 1937-1:1:0 19381:2:1 19392:1:0 19401000000000:9:1 19412000000000:9:2 19423000000000:9:3 19434000000000:9:4 19445000000000:9:5 19456000000000:9:6 19467000000000:9:7 19478000000000:9:8 19489000000000:9:0 194935500000:113:33 195071000000:226:66 1951106500000:339:99 19521000000000:3:1 195310:5:0 1954100:4:0 19551000:8:0 195610000:16:0 1957999999999999:9:0 1958999999999999:99:0 1959999999999999:999:0 1960999999999999:9999:0 1961999999999999999:99999:0 1962-9:+5:1 1963+9:-5:-1 1964-9:-5:-4 1965-5:3:1 1966-2:3:1 19674:3:1 19681:3:1 1969-5:-3:-2 1970-2:-3:-2 19714:-3:-2 19721:-3:-2 19734095:4095:0 1974100041000510123:3:0 1975152403346:12345:4321 197687654321:87654321:0 1977# now some floating point tests 1978123:2.5:0.5 19791230:2.5:0 1980123.4:2.5:0.9 1981123e1:25:5 1982-2.1:1:0.9 19832.1:1:0.1 1984-2.1:-1:-0.1 19852.1:-1:-0.9 1986-3:1:0 19873:1:0 1988-3:-1:0 19893:-1:0 1990 1991&bfac 1992invalid:NaN 1993+inf:inf 1994-inf:NaN 1995-1:NaN 19960:1 19971:1 19982:2 19993:6 20004:24 20015:120 20026:720 20037:5040 20048:40320 20059:362880 200610:3628800 200711:39916800 200812:479001600 200920:2432902008176640000 201022:1124000727777607680000 201169:171122452428141311372468338881272839092270544893520369393648040923257279754140647424000000000000000 2012 2013&bdfac 2014NaN:NaN 2015+inf:inf 2016-inf:NaN 2017-2:NaN 2018-1:1 20190:1 20201:1 20212:2 20223:3 20234:8 20245:15 20256:48 20267:105 20278:384 20289:945 202910:3840 203011:10395 203112:46080 2032 2033&btfac 2034NaN:NaN 2035+inf:inf 2036-inf:NaN 2037-3:NaN 2038-2:1 2039-1:1 20400:1 20411:1 20422:2 20433:3 20444:4 20455:10 20466:18 20477:28 20488:80 20499:162 205010:280 205111:880 205212:1944 2053 2054&bmfac 2055 20567:-inf:NaN 20577:-1:NaN 20587:0:NaN 20597:2.5:NaN 20607:inf:7 20617:NaN:NaN 2062 2063NaN:1:NaN 2064+inf:1:inf 2065-inf:1:NaN 2066-1:1:NaN 20670:1:1 20681:1:1 20692:1:2 20703:1:6 20714:1:24 20725:1:120 20736:1:720 20747:1:5040 20758:1:40320 20769:1:362880 207710:1:3628800 2078 2079NaN:2:NaN 2080+inf:2:inf 2081-inf:2:NaN 2082-2:2:NaN 2083-1:2:1 20840:2:1 20851:2:1 20862:2:2 20873:2:3 20884:2:8 20895:2:15 20906:2:48 20917:2:105 20928:2:384 20939:2:945 209410:2:3840 2095 2096NaN:3:NaN 2097+inf:3:inf 2098-inf:3:NaN 2099-3:3:NaN 2100-2:3:1 2101-1:3:1 21020:3:1 21031:3:1 21042:3:2 21053:3:3 21064:3:4 21075:3:10 21086:3:18 21097:3:28 21108:3:80 21119:3:162 211210:3:280 2113 2114NaN:4:NaN 2115+inf:4:inf 2116-inf:4:NaN 2117-4:4:NaN 2118-3:4:1 2119-2:4:1 2120-1:4:1 21210:4:1 21221:4:1 21232:4:2 21243:4:3 21254:4:4 21265:4:5 21276:4:12 21287:4:21 21298:4:32 21309:4:45 213110:4:120 2132 2133NaN:5:NaN 2134+inf:5:inf 2135-inf:5:NaN 2136-5:5:NaN 2137-4:5:1 2138-3:5:1 2139-2:5:1 2140-1:5:1 21410:5:1 21421:5:1 21432:5:2 21443:5:3 21454:5:4 21465:5:5 21476:5:6 21487:5:14 21498:5:24 21509:5:36 215110:5:50 2152 2153&broot 2154# sqrt() 2155+0:2:0 2156+1:2:1 2157-1:2:NaN 2158# -$x ** (1/2) => -$y, but not in broot() 2159-123.456:2:NaN 2160+inf:2:inf 2161-inf:2:NaN 21622:2:1.41421356237309504880168872420969807857 2163-2:2:NaN 21644:2:2 21659:2:3 216616:2:4 2167100:2:10 2168123.456:2:11.11107555549866648462149404118219234119 216915241.38393:2:123.4559999756998444766131352122991626468 21701.44:2:1.2 217112:2:3.464101615137754587054892683011744733886 21720.49:2:0.7 21730.0049:2:0.07 2174# invalid ones 21751:NaN:NaN 2176-1:NaN:NaN 21770:NaN:NaN 2178-inf:NaN:NaN 2179+inf:NaN:NaN 2180NaN:0:NaN 2181NaN:2:NaN 2182NaN:inf:NaN 2183NaN:inf:NaN 218412:-inf:NaN 218512:inf:NaN 2186+0:0:NaN 2187+1:0:NaN 2188-1:0:NaN 2189-2:0:NaN 2190-123.45:0:NaN 2191+inf:0:NaN 219212:1:12 2193-12:1:NaN 21948:-1:NaN 2195-8:-1:NaN 2196# cubic root 21978:3:2 2198-8:3:NaN 2199# fourths root 220016:4:2 220181:4:3 2202# see t/bigroot() for more tests 2203 2204&bsqrt 2205+0:0 2206-1:NaN 2207-2:NaN 2208-16:NaN 2209-123.45:NaN 2210nanbsqrt:NaN 2211+inf:inf 2212-inf:NaN 22131:1 22142:1.41421356237309504880168872420969807857 22154:2 22169:3 221716:4 2218100:10 2219123.456:11.11107555549866648462149404118219234119 222015241.38393:123.4559999756998444766131352122991626468 22211.44:1.2 2222# sqrt(1.44) = 1.2, sqrt(e10) = e5 => 12e4 22231.44E10:120000 22242e10:141421.356237309504880168872420969807857 2225144e20:120000000000 2226# proved to be an endless loop under 7-9 222712:3.464101615137754587054892683011744733886 22280.49:0.7 22290.0049:0.07 2230 2231&is_nan 2232123:0 2233abc:1 2234NaN:1 2235-123:0 2236 2237&is_inf 2238+inf::1 2239-inf::1 2240abc::0 22411::0 2242NaN::0 2243-1::0 2244+inf:-:0 2245+inf:+:1 2246-inf:-:1 2247-inf:+:0 2248-inf:-inf:1 2249-inf:+inf:0 2250+inf:-inf:0 2251+inf:+inf:1 2252+iNfInItY::1 2253-InFiNiTy::1 2254 2255&is_odd 2256abc:0 22570:0 2258-1:1 2259-3:1 22601:1 22613:1 22621000001:1 22631000002:0 2264+inf:0 2265-inf:0 2266123.45:0 2267-123.45:0 22682:0 2269 2270&is_int 2271invalid:0 22720:1 22731:1 22742:1 2275-2:1 2276-1:1 2277-inf:0 2278+inf:0 2279123.4567:0 2280-0.1:0 2281-0.002:0 2282 2283&is_even 2284abc:0 22850:1 2286-1:0 2287-3:0 22881:0 22893:0 22901000001:0 22911000002:1 22922:1 2293+inf:0 2294-inf:0 2295123.456:0 2296-123.456:0 22970.01:0 2298-0.01:0 2299120:1 23001200:1 2301-1200:1 2302 2303&is_positive 23040:0 23051:1 2306-1:0 2307-123:0 2308NaN:0 2309-inf:0 2310+inf:1 2311 2312&is_negative 23130:0 23141:0 2315-1:1 2316-123:1 2317NaN:0 2318-inf:1 2319+inf:0 2320 2321&is_non_positive 23220:1 23231:0 2324-1:1 2325NaN:0 2326-inf:1 2327+inf:0 2328 2329&is_non_negative 23300:1 23311:1 2332-1:0 2333NaN:0 2334-inf:0 2335+inf:1 2336 2337&parts 23380:0 0 23391:1 0 2340123:123 0 2341-123:-123 0 2342-1200:-12 2 2343invalid:NaN NaN 2344+inf:inf inf 2345-inf:-inf inf 2346 2347&exponent 23480:0 23491:0 2350123:0 2351-123:0 2352-1200:2 2353+inf:inf 2354-inf:inf 2355invalid:NaN 2356 2357&mantissa 23580:0 23591:1 2360123:123 2361-123:-123 2362-1200:-12 2363+inf:inf 2364-inf:-inf 2365invalid:NaN 2366 2367&length 2368123:3 2369-123:3 23700:1 23711:1 237212345678901234567890:20 2373 2374&is_zero 2375invalid:0 2376+inf:0 2377-inf:0 23780:1 2379-1:0 23801:0 2381 2382&is_one 2383invalid:0 2384+inf:0 2385-inf:0 23860:0 23872:0 23881:1 2389-1:0 2390-2:0 2391 2392&bfloor 23930:0 2394abc:NaN 2395+inf:inf 2396-inf:-inf 23971:1 2398-51:-51 2399-51.2:-52 240012.2:12 24010.12345:0 24020.123456:0 24030.1234567:0 24040.12345678:0 24050.123456789:0 2406 2407&bceil 24080:0 2409abc:NaN 2410+inf:inf 2411-inf:-inf 24121:1 2413-51:-51 2414-51.2:-51 241512.2:13 2416-0.4:0 2417 2418&bint 24190:0 2420NaN:NaN 2421+inf:inf 2422-inf:-inf 24231:1 2424-51:-51 2425-51.2:-51 242612.2:12 2427-0.4:0 2428# overloaded functions 2429 2430&log 2431-1:NaN 24320:-inf 24331:0 24342:0.6931471805599453094172321214581765680755 24353:1.098612288668109691395245236922525704647 2436123456789:18.63140176616801803319393334796320420971 24371234567890987654321:41.657252696908474880343847955484513481 2438-inf:inf 2439inf:inf 2440NaN:NaN 2441 2442&exp 2443 2444&sin 2445 2446&cos 2447 2448&atan2 2449 2450&int 2451 2452&neg 2453 2454&abs 2455 2456&sqrt 2457