CHANGES 55.5 KB
Newer Older
1 2 3 4 5 6 7 8
Complete version history of the rewrite project
===============================================

If you just want to see which things are new and different from the original
Math::* in the Perl core, see HISTORY.

The file NEW lists only the changes for the latest version.

9
##############################################################################
10 11 12 13
Math::BigInt::Calc:

2001-07-09 v0.06 Tels
 * first release
14

15
2001-07-15 v0.07 Tels
16 17
 * applied Philip Newtons spelling and doc patch(s)
 * accidentally had the old, slow mul() code in. Oups.
18 19 20 21
 * fixed also a bug in that new code
 * also the speedup in mul() occurs with $x having lots of zeros, not $y.
 * first argument is always classname, so removed checks and shift
 * shift in base ten by _lsft() and _rsft()
22

23 24
2001-07-15 v0.08 Tels
 * fixed bug in mul() shortcut
25

26 27
2001-07-20 v0.09 Tels
 * don't use warnings for older Perls
28

29 30
2001-08-24 v0.10 Tels
 * no longer export anything, ignore import calls
31

32 33
2001-09-07 v0.11 Tels
 * automatically USE_MUL or USE_DIV
34

35 36
2001-10-03 v0.12 Tels
 * _div: 99999 => $BASE-1 ($MAX_VAL), that made some div's fail if $BASE != 5
37

38 39
2001-10-23 v0.13 Tels
 * better detection of BASELEN by matching against expected pattern
40

41 42
2001-11-04 v0.14 Tels
 * added _mod() for faster $x % $y
43

44 45
2001-11-11 v0.15 Tels
 * added _dec() and _inc() for much faster $x++ and $x--
46

47 48 49 50 51 52
2001-11-19 v0.16 Tels
 * fixed comments a bit
 * finished _mod() when $y < $BASE and $BASE % $y != 0 and $BASE % $y != 1
 * streamlined _mod() loops a bit
 * added _pow() for faster bpow()
 * small fix to make 5.005_03 happy ($x = shift @prod vs $x = shift @prod || 0)
53

54 55 56 57 58 59 60
2001-12-06 v0.17 Tels
 * added _sqrt() for more speed
 * _sqrt() shortcut for small (< $BASE) numbers for better performance
 * shortcut in _mul for small numbers (< $BASE_LEN2)
 * added _and, _or, and _xor and let them use more than 16 bits
 * find out how many bits _and, _or and _xor can safely use (cap at 23)
 * div() might leave empty array, so __strip_zeros fixes these
61
 * streamlined _acmp()
62 63
 * cap of 5 for BASE for UTS and UNICOS/Cray
 * better test to find out what BASE should be (use +0.0 to force floats)
64

65 66 67 68
2001-12-20 v0.18 Tels
 * added _as_hex() and _as_bin() with 16 bit chunks
 * from_bin() now uses oct() and 16 bits per iteration
 * removed needless return statements
69

70 71 72
2001-12-23 v0.19 Tels
 * first working version of using two different bases: one for mul/div, the
   other for all other ops, including converting via _to_large()/_to_small()
73

74 75 76 77 78
2002-01-07 v0.20 Tels
 * better detection of higher-int-only base (but disabled due to failures)
 * streamlined converting
 * turned dual-basis off by default (now 7-7 on 32 bit and 9-9 on most 64 it)
 * _str() uses int() on first part to avoid '0000' instead of '0'
79

80 81 82 83
2002-02-10 v0.22 Tels
 * _sqrt1() => _sqrt() (oups)
 * much better guess for _sqrt() resulting in faster sqrt
 * added _fac()
84

85 86
2002-02-24 v0.23 Tels
 * from_bin() repack input and use from_hex(): twice as fast
87

88 89 90
2002-02-27 v0.24 Tels
 * streamlined _mod() shortcuts
 * _div() has shortcut if $y is very small
91

92 93
2002-03-03 v0.25 Tels
 * started _square() (not done yet)
94

95 96 97
2002-03-17 v0.26 Tels
 * a fix in _rsft() that left empty array instead of (0)
 * a fix in _sub(): early out made -1 + 100000000001 == 0 (if length($y) > 8)
98

99 100
2002-05-30 v0.28 Tels
 * added _modinv(), _modpow() (not yet implemented)
101

102 103
2002-06-09 v0.29 Tels
 * filled in _modpow()
104

105 106 107 108
2002-06-10 v0.30 Tels
 * undef mul/div in case Calc.pm get's loaded twice
 * fix in _as_hex() and _as_bin() for older Perls
 * speedups in _pow() and _modpow()
109

110 111 112
2002-08-13 v0.31 Tels
 * _acmp() no longer calls _len() => tad faster
 * some cleanup of old code, added some more comments
113

114 115
2002-08-21 v0.32 Tels
 * fixed bug in _rsft() that did not set result to 0 in some cases
116
 * _modinv() now works, thanx to the all-positive algorithm
117
 * much more tests in bigintc.t (taken over from FastCalc)
118

119 120 121 122
2002-09-09 v0.33 Tels
 * _fac() keep $n as scalar if possible
 * test for when to USE_MUL or not was inverted
 * _mul() is about 6 times faster if $y is small and $x is big
123

124 125 126 127 128
2002-09-27 v0.34 Tels
 * fixed bug in mul_use_div() shortcut that used * $RBASE instead of / $MBASE
 * $caught & 1 != 0 vs ($caught & 1) != 0 (changed to $caught != 2)
 * $i %= $MBASE does not work on ARM (v5.003), so make it $i -= $car * $MBASE
 * removed unused LEN_CONVERT code (smaller memory footprint)
129

130 131 132 133 134
2003-07-06 v0.35 Tels
 * fixed a bug in _floor() which caused ffloor(0.1234567) to fail.
   (Thanx to cpan@ali.as for finding it and sending a fix/testcases)
 * make _as_hex() and _as_bin() handle 0, and make them faster for very
   short numbers (less than BASE_LEN digits)
135

136 137 138 139 140
2003-08-31 v0.36 Tels
 * fixed a bug in div_use_div() that computed remainder wrong if X == X and
   X was very large
 * fixed a off-by-one error discovered with mbi_rand.t in _div_use_XXX()
   (one internal in $x overflowed, thus the wrong computation)
141

142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
2003-12-11 v0.37 Tels
 * implemented _log_int() with a simple and fast "iterative" method
 * fixed bug in _root(): int() rounds sometimes wrong, so use sprintf()
 * _as_bin() and _as_hex() are faster (for small values) due to inlining
   is_zero()
 * _acmp() is about 26% faster for very small numbers or numbers that
   differ in length, and slightly faster for bigger numbers. This helps
   both bacmp() and bcmp()
 * _fac() did:
   + not modify $x in place for small arguments
   + something strange for large arguments
   + not handle 0..2 optimal (code now simplified)
 * _as_bin() used %b, which was not known to v5.5.3 - workaround that
 * implemented _log_int(), which is simple and very fast
 * implemented the missing pieces for _root() (which is quite fast)
157

158 159 160 161 162 163 164
2003-12-30 v0.38 Tels
 * guess _log_int() result based on $base if $base < $BASE
 * _pow() handle cases 0 ** Y, 1 ** Y, X ** 0 and X ** 1
 * _new(): shortcut for short numbers, makes MBI->new() about 20% faster
 * _root() was wrong for numbers like 9 (0b1001) because they start with
   the pattern /^0b1(0+)/ (missing '$' in regexp) and after fixing this
   it was dead slow for large numbers.
165

166 167
2004-01-25 v0.39 Tels (not released)
 * _zeros(0) is 0, not 1
168

169 170 171 172 173 174 175 176 177
2004-03-12 v0.40 Tels
 * added: api_version(), _ten(), _two(), _is_ten(), _is_two(), _gcd()
 * streamlined: is_foo() methods
 * _new() takes scalar, not scalar ref
 * _str() returns scalar, not scalar ref
 * _and(): bugfix for [perl #26559]: negative arguments that are shorter
    than the positive one caused an error due to cutting instead padding
 * _ior(): forgot to calculate the proper sing of result, making, for
    instance, 30 | -4 go wrong
178

179 180
2004-04-05 v0.41a Tels (not released)
 * removed the unused integer-detection code and combined the two BEGIN blocks
181

182 183 184 185
2004-07-30 v0.41 Tels
 * from_hex() convert 28 bits (vs 16) at a time, faster (helps from_bin(), too)
 * potential bug in padding with '0' in _digit()
 * fixed undef warnings in fceil(0.222222222222...) (thanx kenny!)
186

187 188 189
2004-10-10 v0.42 Tels
 * fix critical bug in _from_hex() with parts that were to big for one part
   (introduced in v1.72, thanx Mark Lakata for finding it!)
190

191 192 193
2005-01-01 v0.44 Tels
 * small cleanups
 * shortcut for numbers of same length in _div, where X > Y
194

195 196
2005-03-20 v0.45 Tels
 * fix the div() shortcut for short numbers to actually work
197

198 199
2005-03-29 v0.46 Tels
 * avoid crash in FastCalc by making $BASE and $BASE_LEN use vars qw//;
200

201 202
2005-05-17 v0.47 Tels
 * remove shortcut in div(), it wasn't working properly
203

204 205
2007-01-27 v0.48 Tels
 * support for octal numbers
206

207 208 209
2007-04-16 v0.49 Tels
 * API version 2.0 support: add _1ex(), _alen()
 * make _fac() about twice as fast
210

211 212 213 214
2007-05-05 v0.50 Tels
 * speed up _mul() by "use integer;"
 * we do not need to remove zeros after mul()
 * implement an alternative algorithm for _fac()
215

216 217 218
2007-05-30 v0.51 Tels
 * use CORE::hex() instead of hex() to help bigint/bignum/bigrat
 * use 9 digit parts on 64bit integer or long double systems
219

220 221 222
2007-09-16 v0.52 Tels
 * fix 64bit ints on Perl v5.8.0 (thanx zefram)

223
##############################################################################
224 225
Math::BigInt::CalcEmu:

226

227 228
2003-12-26 v0.01 Tels
 * first version, taken over all the code from BigInt
229

230 231
2003-12-30 v0.02 Tels
 * the code in Calc::_root() uses now sprintf(), but the one in Emu was not
232

233 234
2004-01-13 v0.03 Tels
 * $VERSION was overriding the $VERSION from MBI (Thanx Gisle Aas!)
235

236 237 238
2004-03-12 v0.04 Tels
 * removed unnec. emulation routines (all except _signed_foo)

239
##############################################################################
240 241
Math::BigInt::Scalar:

242

243 244
2001-07-09 v0.04 Tels
 * first release
245

246 247
2001-07-15 v0.05 Tels
 * first argument is always classname, so removed checks and shift
248

249 250
2001-07-20 v0.06 Tels
 * don't use warnings for older Perls
251

252 253
2001-08-24 v0.10 Tels
 * no longer export anything, ignore import calls
254

255 256 257 258 259
2002-01-07 v0.11 Tels
 * fixed version
 * added DESCRIPTION section to stop pod2man complaining
 * added _dec, _inc

260
##############################################################################
261 262
Math::BigFloat:

263

264
2001-02-18 1.00: started work
265

266
2001-02-22 1.01: new() and bstr() work now (sort of)
267

268
2001-02-24 1.02: add()/sub() should work now
269

270
2001-03-06 1.03: layed more foundations (mul() etc)
271

272
2001-03-27 1.04: bmul/bdiv/cmp work now, better _norm()
273

274
2001-03-31 1.05: fixed bstr() and bsstr()
275 276
                 added AUTOLOAD for fxxx() to work as well as bxxx()
                 enhanced and fixed testsuite for mul/cmp/add/new
277

278
2001-04-05 1.06: bstr() returns NaN for NaN's
279 280 281 282 283 284
                 renamed _norm to bnorm, added it to AUTOLOAD for compatibility
                 fixed bug Math::BigFloat->new(Math::BigInt->new(3));
                 bug mul/div when second arg was BigInt
                 bdiv() works now with precision
                 precision()
                 doc about mixing different objects in overloaded math
285

286
2001-04-07 1.07: bug in bstr() for 0.xxx style numbers, as well as for "-xxx"
287 288 289
                 babs(), bneg(), bint() work now
                 empty stubs for bsqrt(), bround() and bmod()
                 exponent(), mantissa(), parts() work now as expected
290

291
2001-04-18 1.08: exponent(), mantissa() and parts() now return BigInt's
292 293 294
                 bnorm: 0Ey => 0E1 (was wrongly 0E0)
                 fixed is_zero()
                 added bround() and bfround() (only truncate mode)
295
                 fixed bug in bstr() for 1.203E-2 style numbers (Thanx Tom!)
296

297
2001-04-23 1.09: length() in list context return length of mantissa & exponent
298 299 300
                 bug in bstr() for '0.x' style strings
                 added bsqrt()
                 workaround for Perl v5.6.0 overload-bool bug (via MBI)
301
                 fixed rounding
302

303
2001-05-07 1.10: Tom's round fixes (minus one nit)
304
                 new: .xxx, -.xxx, +.xxx etc are valid inputs, while
305 306
                 '.', 'x x x' and 'Exxx' are now invalid
                 finally got rid of C&P of overload section and clone()
307

308
2001-05-09 1.11: bug bcmp() (1e-08 was < 0, aka fractions were broken)
309

310 311 312 313 314 315
2001-05-11 1.12 Tels
 * taken over testsuite from John P.
 * added tests for compare with fraction
 * fixed fcmp/fround/ffround
 * added accuracy/precision/fallback/round_mode
 * bsstr('NaN') returned 'NaNeNaN'
316

317 318 319 320 321 322 323 324 325
2001-06-09 1.13 Tels:
 * adjusted fdiv() so that it now works proper with old testcases
 * (except a few nits, see testsuite and ACCURACY)
 * fdiv() in listmode (uses non-working fmod())
 * fixed/test A/P after each op
 * $x->accuracy(), $x->precision() actually round $x to the value A/P
 * fixed fpow(), added tests for it
 * hexadecimal integer input (0xdeadbeef)
 * is_one() for -1 was wrongly true, tests for is_one()
326

327 328 329 330 331 332 333 334
2001-06-13 1.14 Tels:
 * accuracy/precision rounding after fdiv() was missing
 * binary integer input (0b01110 etc)
 * A/P rounding after fdiv() was missing
 * '-0x0' would wrongly leave '-0'
 * as_number() was wrong for negative numbers and had no tests
 * added is_even(), is_odd(), _set(), the inherited ones were broken
 * fixed is_zero() for NaN
335
 * $x->bpow($y) for negative $y was unfinished
336 337
 * added is_inf(), binf() and some support for +-inf in new(), bsstr() etc
 * added tests for is_odd(), is_even(), _set() and is_zero(), is_inf(), bsstr()
338

339 340
2001-06-15 v1.15 Tels
 * added bfloor(), bceil()
341

342 343
2001-07-09 v1.16 Tels
 * is_positive(), is_negative()
344
 * various pod fixes (overlong =item, spelling erorrs etc)
345 346 347
 * removed internal _set() and the tests for it
 * infinity support for fcmp(), fpow()
 * nailed the bug in fdiv() that caused fsqrt() to fail. fsqr() works now, too.
348
 * more tests
349

350
2001-07-15 v1.17 Tels
351
 * applied Philip Newtons spelling and doc patch(s)
352 353
 * added bone()
 * tests for bnan() and bone()
354

355 356 357 358 359 360
2001-08-02 v1.19 Tels
 * 123/+-inf => 0, test for that and -1,0 / NaN => NaN
 * +123 / 0 => +inf, -123 / 0 => -inf (was missing in MBF)
 * fixed +-inf handling in bacmp/bcmp/bsub/badd/bdiv and tests for that
 * padd bstr() output of numbers with set A or P
 * remove bfloat() (Math::BigInt->bfloat() did not work, anyway, see bint())
361

362 363 364
2001-08-03 v1.20 Tels
 * streamlined bcmp
 * drop leading '+' for inf
365

366 367 368 369 370 371
2001-09-03 v1.21 Tels
 * serious bug in bcmp() caused 1.5 to be greater than 2. Yikes!
 * bcmp() did not only return -1,0,1 and undef but other values, too
 * new('inf') produced NaN (was expecting '+inf')
 * exponent(), mantissa() & parts() failed or returned scalars for inf,-inf,NaN
 * include finf in AUTOLOAD list
372

373 374 375 376 377
2001-10-03 v1.22 Tels
 * Quite a lot of rounding fixes
 * $x->bnorm() is 4 times faster if $x == 0
 * $x->bround($n) is 43 times faster if $n > $x->{_a} (no-op)
 * added as_number()
378

379 380 381
2001-10-05 v1.23 Tels
 * fixed facmp() (was broken the same way as fcmp())
 * more rounding fixes from John P.
382

383 384 385 386
2001-11-11 v1.24 Tels
 * bacmp() fix for +-inf
 * streamlined new()
 * faster finc()/fdec()
387

388 389 390 391 392
2001-11-18 v1.25 Tels
 * streamlining fixes in new() were missing
 * further streamlining in new() for 12345e1234 cases (fraction part empty)
 * added $rnd_mode support for compatibility
 * replaced the 'laber schwad blah blah' pod section by a pointer to MBI
393

394 395 396 397 398 399 400 401 402 403
2001-12-06 v1.26 Tels
 * fneg() failed (now hand up to MBI)
 * frsft() and flsft() were no aliases to brsft() and blsft()
 * fone() was no alias for bone()
 * blsft() and brsft() were missing altogether
 * streamlined: fpow() and fmul()
 * removed the EXPORT_OK
 * fqsrt() uses now BigInt::bsqrt() as guess: greatly improved performance
 * make fsqrt() subclass proof by using $self instead of Math::BigFloat
 * bzero(), bone(): take additional A and P and store 'em
404
 * bnan(), binf(): clear A and P
405

406 407 408 409 410 411 412 413 414
2002-01-06 v1.27 Tels
 * overload for log() and flog()/blog()
 * bzero()/bone() handling of A & P was broken
 * bround()/bfround() handling of zeros forgot to set A & P
 * fdiv: fixed a bug in round to A with given round_mode (always used global)
 * fsqrt(): would hang/fail if either $x's or global A or P were set
 * fsqrt() didn't modify $x sometimes, but returned a new reference
 * fsqrt(): calc 4 more digits for rounding, not 1 (endless looping otherwise)
 * fmod() now actually works
415

416 417 418
2002-02-10 v1.27 Tels (forgot to increase version)
 * ffac()
 * various: disable Math::BigInt::upgrade to avoid deep recursion
419

420 421 422
2002-02-16 v1.28 Tels
 * fixed use Math::BigFloat ':constant';
 * fixed flog() function to calc right result, honour rounding-globals
423

424 425 426 427 428
2002-02-24 v1.29 Tels
 * overload for 'log' now inherited by BigInt
 * _binf(), _bnan(), _bone() and _bzero() instead of longer bone() etc
 * inf/NaN fixes from v1.51 were missing for BigFloat
 * bdiv() upgrades if applicable
429

430 431 432 433 434 435 436 437 438 439 440
2002-02-25 v1.30 Tels
 * bug in bsub() with not rounding when $x->bsub(0) was also in MBF
 * bcmp() and bacmp() 5 times faster due to numify() (might have now impose a
   limit on exponent - but I couldn't find a test that breaks it)
 * streamlined ffloor() and fceil()
 * fixed bug in $x->bsub(0) and $x->badd(0) (both forgot to round result)
 * new() downgrade integers if $downgrade is in effect
 * optimized fpow() (one is_zero() less)
 * optimized as_number (nearly twice as fast)
 * $x->badd(0) forgot to round $x
 * downgrade and upgrade are valid methods for inheritance
441

442 443
2002-03-03 v1.31 Tels
 * bpow() can handle second arguments beeing non-integer (f.i. 2 ** 0.2)
444
 * $x->bpow(0.5) optimized to $x->bsqrt();
445

446 447 448
2002-05-19 v1.32 Tels
 * upgrade used badd() instead of bmul() inside bmul()
 * bpow() now uses slower, but more correct way for fractions (this needs work)
449

450 451
2002-06-09 v1.33 Tels
 * import() fixed for older Perls
452

453 454
2002-06-10 v1.34 Tels
 * upgrade used badd() instead of bmul() inside bmul() (again! arg!)
455

456
2002-07-07 v1.35 Tels
457
 * bfround() used accidentally BigInt math; is now about 5.6 times faster for
458 459 460 461 462
   small numbers
 * bdiv()/badd() etc skip objectify() if possible and are thus faster
 * doc for accuracy()/precision()
 * $x->bmod() was not modifying $x in place when returning NaN/inf/-inf
 * avoid unec. calls to objectify() for binary op's
463

464 465 466 467 468 469 470
2002-08-13 v1.36 Tels
 * as_hex() and as_bin() work now at least for inf, NaN and integers
 * fixed bsstr() (and thus also numify()) for negative numbers - Ouch!
 * $x->new("0.02"); $x->accuracy($a); $x->bdiv($y,$d) failed to round
   when $d > $a
 * numify() returned '+inf' instead of 'inf'
 * (more) tests for bsstr(), numify(), as_hex(), as_bin
471

472 473
2002-08-20 v1.37 Tels
 * bcmp()/bacmp() upgrade now if requested
474

475 476 477 478 479 480 481 482 483
2002-09-08 v1.38 Tels
 * fix that bsqrt() would hang for certain inputs. Instead of using Newton's,
   we now rely on the fact that sqrt(x*y) = sqrt(x) * sqrt(y) by setting y to
   100. This removes the while loop entirely and makes it much faster while
   fixing the bug at the same time.
 * $x->bsqrt(0) did needless warn about undef values, and round to 4 digits
   instead of beeing equivalent to $x->bsqrt(undef)
 * ditto for $x->bpow($y,0), $x->blog($base,0) and $x->bdiv($y,0)
 * use File::Spec was needless, since it was required later on again
484

485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509
2002-11-03 v1.39 Tels
 * $x->bpow($y,0), $x->blog($base,0) and $x->bdiv($y,0) were still not doing
    the right thing and no tests caught it *sigh*
 * blog():
   + MUCH faster when $x > 10 or $x < 0.1 (constant time vs.
     time * 10 when doubling/halving $x)
   + also much faster if $x has many digits (like 1/3 or 123**123)
   + for $x < 1 and $x > 0 did not work at all (bacmp vs bcmp)
   + returns now NaN if $base <= 0 or $base == 1
   + does handle other bases than "undef" (aka e) properly now
 * require Math::BigFloat did not work (opposed to BigInt, where it does)
 * _pow() suffered the same bug of bacmp vs bcmp (so 0.2 ** 0.2 failed)
 * removed unused _pow2() routine
 * _find_round_parameters() returns ($x,$a,$p,$r) and not ($a,$p,$r), so
   use it correctly, and also test for $x = NaN afterwards
  (happens when $a and $p were set and thus $x became NaN)
 * bsqrt() failed since v1.63 for values like 0.2, 0.002, 0.00134 etc
 * added broot() method (albeit slow for now)
 * $x->is_one('-') was broken (never returned true for $x == -1)
 * config() can take arguments and set them, croak on wrong ones
 * config(trap_nan => 1) to manipulate former $NaNOK variable
 * config(trap_inf => 1), too
 * trap_nan/trap_inf really croak on any attempt to create an NaN/inf
 * spellings of Bigint => BigInt
 * simplify config() by using SUPER::config()
510

511 512 513
2003-07-06 v1.39 Tels
 * $x->blog($base) can handle a $base which is a Math::Bigint
 * replace die() with Carp::croak
514

515 516 517 518
2003-09-23 v1.40 Tels
 * bstr(): removed unnec. BigInt math and inlined is_zero() => great speedup
   (10% to factor 6.5 depending on input)
 * replace $self->_one() by $self->bone()
519

520 521 522 523 524 525 526 527 528 529 530
2003-12-11 v1.41 Tels
 * flog(): 0.5, 0.25, 0.125, 2, 4 and 8 were not scaled properly back to
   1, instead they remained 0.5 and 2, respectively. This was a '<' vs.
   '>=' respective '<' vs. '<=' issue. No other values are affected
   (neither getting slower nor faster), but the ones in question (incl.
   their multiples like 20, 80, 0.0125 etc) are now tremendously faster -
   about a factor of 30 to 60! :-)
 * removed some crufty logic from _log_10() and made the special cases of
   2, 10 and 0.1 slightly faster. This also helps log($x,2) and log($x,10).
 * bfac() slightly faster for small arguments
 * downgrading to bigint failed for .2e2 (produced 200 vs. 20)
531

532 533 534 535 536 537
2003-12-30 v1.42 Tels
 * ffac(inf) is inf, not NaN
 * flog() calculate integer result first, and if it fits, return it
   this makes it much faster in case the result is a perfect integer
 * require (instead of use) Exporter
 * froot() calculates an integer result first, and it if fits, returns it
538

539 540 541
2004-01-13 v1.43 Tels
 * small fixes in AUTOLOAD
 * delete $x->{_a} vs. $x->{_a} = undef to save memory
542

543 544 545 546 547 548
2004-03-12 v1.44 Tels
 * bpow() computed -X ** Y wrong for Y that are odd
 * use $HALF instead of 0.5 to speed up broot()
 * use Calc instead of BigInt for parts, that makes it roughly 2x faster
   it also saves memory (419 vs. 767 bytes per (small number) object)
 * bmod() did needlessly test for NaN arguments twice
549

550 551 552 553 554 555 556
2004-07-30 v1.45 Tels
 * simple inherit bsub() from BigInt, also fixes bsub() failing under
   $x -= $x - Thanx Peter J. Acklam!
 * bdiv() failed when passed a variable twice (thanx Peter J. Acklam!)
 * bfround() and bround() are about 10% faster when going via Math::BigInt's
   bround() due to constructing a fake BigInt instead of going via ->new()
 * fixed undef warnings in bpow(0,$y) ($y non-integer) (thanx kenny!)
557

558 559
2004-08-13 v1.46 Tels
 * blog(10,10) ($x == $y) returned '1.0000...' instead of '1'
560

561 562 563 564 565
2004-10-10 v1.47 Tels
 * inf/NaN fixes for bpow()
 * eliminate the need for _zeros() in new() (speed-up for GMP et. al.)
 * eliminate _is_zero() in new() (small speed up)
 * added shortcut for simple numbers in new() (speed up)
566

567 568 569 570 571 572 573
2005-01-01 v1.48 Tels
 * use new interface to _scale_a() and _scale_p() in BigInt
 * add bneg() and inline is_zero() in it, making it 1.6 times faster
 * replace ref($_[0]) w/ undef when it isn't actually needed. This
   makes some ops (bsstr(), bneg etc) about 2% faster for small numbers
 * use MBI::_register_callback() to get notified of lib changes
 * bgcd()/blcm() never worked, so fix them for integers and add tests
574

575 576 577 578
2005-03-20 v1.49 Tels
 * remove dependecy on Scalar::Util in bdiv()
 * bdiv() cache result of "!$y->is_one()" for wantarray case to make
   ($res,$rem) = $x->bdiv($y); about 10% faster
579

580 581 582
2005-03-29 v1.50 Tels
 * fix rounding doc, add notes about prevision vs. accuracy
 * set FastCalc as default (we still use whatever MBI uses)
583

584 585
2005-04-10 v1.51 Tels
 * fix new() to work with Math::BigInt::Pari
586

587 588 589 590 591
2007-01-27 v1.52 Tels
 * fix brsft() and bpow() in list context only return on number (bug #21413)
 * make as_int() return a BigInt, too (not just as_number()) (bug #21412)
 * add as_oct()
 * bpow(): handle negative X and negative Y (instead of returning NaN)
592

593 594 595 596 597 598
2007-03-04 v1.53 Tels
 * fix #25144: [PATCH] Math::BigFloat->new considers any reference a BigInt
   (Thanx mschwern!)
 * fix bug #13866: NaN (in bignum queue)
 * fix bug #21586: Incorrect result when comparing with NaN
 * fix bug #15896: "==" overloading is broken for "NaN"
599

600
2007-04-09 v1.54 Tels
601
 * fix bug #21747: Re: weirdity in bignum... (powers and high precision):
602 603 604 605 606 607 608 609 610 611
   infinite loops for blog() (and consequently bpow()) if you requested
   an accuracy greater than 67 digits (uses _log() now, and not blog())
   Thanx to darconc!
 * cache the result of _log(2) and _log(10) so that subsequent calculations
   can re-use the already done work
 * instead of computing _log(10), compute _log(1.25) and _log(2) and then do:
    _log(1.25 * 2 * 2 * 2) = _log(1.25) + _log(2) + _log(2) + _log(2)
   This makes computing _log(10) much faster, so that computing blog(N) is
   about a factor of 5 faster when N >= 10 or N <= 0.1
 * add bexp()
612

613 614 615 616
2007-04-16 v1.55 Tels
 * make bexp() much faster (esp. under GMP) by caching the first coefficients
   and rewriting the inner loop
 * support "try" and "only" in import()
617

618 619 620
2007-05-05 v1.57 Tels
 * add bnok() method (n over k)
 * add all the missing modify() hooks
621

622 623 624 625 626 627
2007-06-30 v1.58 Tels
 * remove Exporer from @ISA
 * support config('lib') as shortcut for config()->{lib}
 * add bpi(), bcos(), bsin(), batan(), batan2() methods
 * add bmuladd()
 * streamline the is_xxx() and copy() methods
628

629 630 631 632
2008-04-20 v1.60 Tels
 * fix #34459: bsqrt() breaks on floats with enough digits (Thanx Niko Tyni!)
 * fix #35238: batan2() handles inf/+inf wrong
 * fix #35162: MBI segfault (as_number(Math::BigRat()) was wrong)
633 634

##############################################################################
635 636
Math::BigInt:

637

638 639 640 641 642
2000-11-13 v1.02 Tels
 fixed sub and mul (sort of)
 found out that "$wanted = shift || return bzero()" causes a call to numify,
 testing for undefined fixes this problem (but might waste more time for
 a new(0), will save time on average.
643

644 645 646
2000-11-14 v1.03 Tels
 x**0 => 1 (instead of x)
 fixed bigintpm to include bpow, binc, bdec, new() test
647

648 649 650
2000-11-15 v1.04 Tels
 fixed bigintpm to test '++' and '--' properly
 done div, fixed mul/bpow (13 tests remain)
651

652 653 654
2000-11-16 v1.05 Tels
 8 tests remain
 new copies _all_ fields, not only Math::Bigint ones
655

656 657 658
2000-11-19 v1.06 Tels
 7 tests remain
 bgcd accepts lists, added blcm
659

660 661
2000-11-20 v1.07 Tels
 objectify fixed to not make copies and work with subclasses
662

663 664
2000-11-22 v1.08 Tels
 fixed all but one test (band bior bxor etc)
665

666 667
2000-11-23 v1.09 Tels
 fixed bug in bmul (and thus bpow) (self multiply works now)
668

669 670
2000-11-24 v1.10 Tels
 finally made it Math::BigInt (w/o trailing 's')
671

672 673 674 675 676 677 678
2001-02-14 v1.11 Tels (first release)
 * fixed bug in band(), bxor(), etc that used badd($x, fixed_number_here);
 * since subclasses might not be happy with fixed numbers, make sure we pass
   BigInts all the time if using something like $someclass->badd();
 * fixed bug in band/bxor/bior which destroyed second argument
 * bxor/band/bior work now correctly for subclasses
 * ++ and -- are now a tad (ca 5%) faster
679

680
2001-02-16 v1.12 Tels
681
 * accidentally dropped self-multiply test in bigintpm.t
682 683
 * fixed bug in overloading cmp
 * after correcting the overload for 'cmp', I got a lot of test failings and
684 685
   finally discovered that the bstr()'s return of '[+-][0-9]+' instead of
   Perls ways of '[-]?[0-9]+' breaks string comparisons with numbers :(
686 687 688 689 690 691 692 693
   F.i. ok() from Test.pm uses 'eq' and you can not do ok($a,3*3) where $a
   is a BigInt. IMNSHO clearly wrong. And only changing the way cmp is
   overloaded would lead to the curios situation that the following:
   'print "$a eq $b" if $a eq $b;' would print "+3 eq 3", which looks wrong.
   Mark B. said go ahead and change bstr(), so I changed it ;) to drop
   the '+', adapted all the tests, changed the doc, etc.
   BigInts behave now transparently like build-in scalars in integer/string
   context ;o)
694

695 696
2001-02-18 v1.13 Tels
 * got rid of duplicated copy() code in new()
697

698 699 700 701 702 703 704
2001-02-21 v1.14 Tels
 * overload +=, -=, *= and /= for about 20-30% more speed if both args have
   roughly same length
 * shortcut in add() makes $x += $y; $x -= $y; for large $x and small $y
   an O(1) case instead of O(N)
 * fixed (non-critical) bug that caused objectify in numify/bool/stringify to
   create scratch objects from undef params.
705

706 707 708 709 710 711 712 713
2001-02-24 v1.15 Tels
 * $x / $x is now a lot faster (more O(1) than O(N))
 * 10 ** $x is now a lot faster (more O(N/5) instead of O(N))
 * overload of **= makes $x **= $y faster
 * 0 ** 0 was NaN, not 1
 * -a % b = +c (was -c) to be compatible with perl
 * added $x->length() and test for it; fixed _digits() (was off by 1)
 * objectify() was not exported, added tests for objectify()
714

715 716 717 718 719 720 721 722 723 724 725 726
2001-03-09 v1.16 Tels
 * Math::BigInt::badd(4,5) and Math::SomeChildOfBI->badd(4,5) work now
 * '$x = scalar (**|%|+|-|*|\) $object;' failed (was not tested, either)
 * 'if ($x)' is now O(1) instead of O(N) and at least twice as fast
 * fixed nasty bug in _digits that caused <=> after add/sub/mul etc to fail
   if result was between 100001 and 109999, added test for this
 * added test cases for op's that should preserve args (+,+=,abs(), neg() etc)
 * added tests for overloaded 'bool'
 * added test.pl and some examples (prime.pl, bigprimes.pl)
 * tests after "use Math::BigInt :constant" were screwed due to not using eval
 * $x->numify() (for $array[$x] = 0; etc) is much faster now
 * added caveat documentation for $x = -$x; and $x *= string1 operator string2;
727

728 729 730 731 732
2001-03-24 v1.20 Tels
 * added: is_nan()
 * bug in bmod/bdiv, I forgot some cases with negatives. Thanx to Bruce Fields!
 * documented ':constant' and eval() crash on Perl 5.00x
 * documented BigInts behaviour of bmod/bdiv and use integer
733

734 735
2001-03-30 v1.21 Tels
 * bool() works now under 5_005
736
 * bug in bsub where numbers with at least 6 trailing digits after any op failed
737

738 739 740 741 742 743
2001-04-05 v1.22 Tels
 * documented Peters OS/390 patch/changes (fix was in for quite some time)
 * fixed bug Math::BigInt->new(Math::BigFloat->new(3));
 * objectify() with other objects than BigInt as further args, copy() etc
 * $x->digit($n) to query fast value of Nth digit
 * as_number()
744

745
2001-04-07 v1.23 Tels
746
 * spelling errors in pod
747

748 749 750
2001-04-23 v1.3 Tels
 * added (compatible to MBF) mantissa(), exponent() & parts() as well as tests
 * _trailing_zeros()
751
 * fixed as_number() to return copy of BigInt
752 753 754 755 756
 * added bround(), bfround() and support for round_mode() as well as $rnd_mode
 * fixed bug in bdiv() wich left reminder "-0", causing further op's to die()
 * added is_valid to testsuite to see whether invalid objects are created
 * added bsqrt()
 * workaround coredump bug in bool() for v5.6.1
757

758 759 760 761 762 763 764 765
2001-05-08 v1.31 Tels
 * _ between digits now accepted, ' ' no longer valid inside (but at front/end)
 * Exxx is NaN, and no longer produces warning
 * .xxx style numbers are valid input
 * tests for 1E1, 123E-2, 1E2 etc style input to Bigint.pm
 * fixed overload (w/ _swap/copy), subclasses can inherit it easily
 * removed clone()
 * added bsstr()
766

767 768
2001-05-11 v1.32 Tels
 * added accuracy/precision/fallback/round_mode
769

770 771 772 773 774 775 776 777 778 779 780
2001-06-09 v1.33 Tels
 * bround() no longer uses 10 ** $pad and is thus much faster when rounding up
 * fixed and added rounding benchmark (did time bmul instead bround)
 * blsft(),brsft(): can work in different bases, check against invalid
   inputs, more tests, speedup when in base 10
 * _trailing_zeros is 50% faster
 * A/P after each op, tests for it in accuracy.t
 * round() instead of bnorm()
 * $x->accuracy(), $x->precision() actually round $x to the set value
 * tests for is_one()
 * hexadecimal integer input (0xcafebabe etc)
781

782 783 784 785 786
2001-06-13 v1.34 Tels
 * binary integer input (0b01110 etc)
 * fixed: '-0x0' left '-0'
 * added is_inf(), binf() and some support for +-inf in new(), bsstr() etc
 * added tests for is_odd(), is_even(), _set() and is_zero(), is_inf(), bsstr()
787

788 789 790
2001-06-15 v1.35 Tels
 * added bfloor(), bceil()
 * fixed bior(), bxor(), band() for $x->bxxx(NaN,0), added modify() to them
791

792 793
2001-07-04 v1.36 Tels
 * is_positive(), is_negative()
794
 * various pod fixes (overlong =item, spelling erorrs etc)
795 796 797 798 799
 * torn out the bones from under the flesh and moved them to Math::BigInt::Calc
 * added Math::BigInt::Calc, Math::BigInt::Small (and Math::BigInt::BitVect)
 * fixed tests for bacmp() (could never fail)
 * removed internal _set() and tests for it
 * +-inf handling in bcmp(), bpow()
800

801
2001-07-15 v1.37 Tels
802
 * applied Philip Newtons spelling and doc patch(s)
803
 * Benjamin Trott: _split() is faster for numbers that need no splitting
804
 * Benjamin Trott: don't take shortcut in badd(), or Pari won't work
805 806 807 808 809 810 811 812
 * allow use Math::BigInt lib => 'Pari,BitVect,Foo,Bar';
 * delegate shifting to CALC if possible, otherwise fallback
 * test for self-pow, to see if lib's fail (since BitVect failed for self-pow)
 * _one() => bone()
 * +x / 0 => +inf, -x / 0 => -inf, while 0/0 and +-x % 0 are still NaN
 * tests for bnan() and bone()
 * Math::BigInt::Calc now determines biggest $BASE to use. Default should now
   be 1e7 on most systems, giving 20% to 40% speedups.
813

814 815
2001-07-15 v1.38 Tels
 * test for mul() shortcut
816

817 818 819 820 821 822
2001-08-02 v1.39 Tels
 * fixed history (duh!)
 * assign return values from $CALC back to $x->{value}
 * fixed +-inf handling in a lot of places and tests for that
 * band(), bxor() and bior() now work with negative inputs
 * remove bint() (Math::BigFloat->bint() just DNDWIM and no sense, either)
823

824 825 826 827 828 829
2001-08-03 v1.40 Tels
 * bxor(-$x,-$y) was broken (and not tested *sigh*)
 * streamlined bcmp
 * drop leading '+' for inf
 * bxor(), band(), bior() with negative arguments don't get passed to lib
   (makes it work with BitVect, Pari, GMP etc)
830

831 832
2001-08-08 v1.41 Tels
 * fixed inf test (coredumps)
833

834 835 836 837 838 839 840 841
2001-09-03 v1.42 Tels
 * bug in overload section causing performance losses in subclasses
 * call $CALC->import() with list of libs
 * odd numbers never have trailing zeros, so don't convert them to DEC to look
 * as_hex() and as_bin()
 * $x->bmod() did not modify $x, only returned result. Oups.
 * new('inf') produced NaN (was expecting '+inf')
 * exponent(), mantissa() & parts() failed or returned scalars for inf,-inf,NaN
842

843 844 845
2001-10-05 v1.43 Tels
 * $x->bround($n) is 43 times faster if $n > $x->{_a} (no-op)
 * Heaploads of rounding fixes (and tests)
846
 * Test for 99999-bug in Calc
847

848
2001-11-04 v1.45 Tels
849
 * tests run now in subclass, too
850 851 852
 * bmod() can use _mod in lib
 * lots of tests fixed (assumed wrong base etc) and added
 * bpow() about 10-15% faster for small numbers (like 2 ** 150, 3 * 200 etc)
853

854 855 856
2001-11-11 v1.46 Tels
 * binc(),bdec() use lib (via _inc(),_dec()) => faster (see BENCHMARK)
 * avoid the unnec. rounding bsub()/binc()/bdec() (badd() already took care)
857
 * made bsub() faster by removing the bneg() overhead from it
858

859 860 861 862 863
2001-11-18 v1.47 Tels
 * added $rnd_mode support for compatibility
 * two 'my $t = ... if ..;' cases to 'my $t; $t = ... if ...;'
 * added overload for %=, |=, &= and ^= for more speed
 * _split(): check for 1e2e3 and reject it
864

865 866 867 868 869 870 871 872 873 874
2001-12-06 v1.48 Tels
 * fixed pod in many places
 * bmod: use round(), not bround()
 * bsqrt: use _sqrt() from lib, if possible
 * bsqrt: would hang for certain (most?) inputs
 * bdiv: slow check for 1 || -1 replaced by much faster version
 * bdiv: call _div() only when nec. in list context, otherwise scalar
 * streamlined copy(), _find_round_parameters()
 * removed the EXPORT_OK except for objectify, _swap and bgcd/blcm
 * bzero(), bone(): take additional A and P and store 'em
875
 * bnan(), binf(): clear A and P
876

877 878 879 880 881 882 883 884 885 886
2002-01-07 v1.49 Tels
 * as_hex() and as_bin() use 16 instead of 8 bits per iteration
 * overload for log() and blog()
 * tricks to make 'require Math::BigInt' and 'use Math::BigInt();' work again
 * use $CALC instead of require for newer Perls (test for $] > 5.006 vs 5.6)
 * bzero()/bone() handling of A & P was broken
 * bround()/bfround() forgot to set A or P for zeros
 * embedded _find_round_parameters into round(), streamlined both versions
 * round() now uses string-add to make it almost twice as fast
 * bnot() did round twice
887

888 889 890 891 892 893 894 895 896
2002-02-10 v1.50 Tels
 * bfac() and hook for _fac() in libs
 * documented sub-classing and auto-upgrade
 * < 4 test in bsqrt() after the CALC call for more performance
 * added overload for sqrt()
 * added possibility to upgrade via use Math::BigInt upgrade => 'Foo::Bar'
 * Math::Big(Int|Float)->accuracy() clears precision, and vice versa
 * small optimization in bdiv() regarding abs($x) < abs($y)
 * brsft() for negative numbers in base 2 was completely wrong
897

898 899 900 901 902 903
2002-02-16 v1.51 Tels
 * fixed bfround(-x) (f.i. 0.004->bfround(-2) resulted in 0.01, not 0.00)
 * bfround(x) rounded at wrong place (off by one)
 * calling bfround(x) rounded further and further instead of keeping result
 * blog() upgrades if requested
 * added doc stub for every public function
904

905 906 907
2002-02-24 v1.52 Tels
 * hooks for _bin(), _bnan(), _bone() and _bzero()
 * =head2 section for accuracy
908

909 910 911
2002-02-27 v1.53 Tels
 * precisision typo
 * fixed overlong pod =item
912
 * added downgrade()
913

914 915 916
2002-03-03 v1.54 Tels
 * really fixed overlong pod =item
 * downgrade() and upgrade() with undef as argument didn't clear the variable
917
 * bmul() upgrades if second argument is non-integer
918 919 920 921
 * bdiv() upgrades if $x > $y
 * bpow() upgrades if second argument is non-integer
 * objectify disable downgrade (for MBF)
 * new() twice as fast due to shortcut simple numbers, save _split() & _round()
922

923 924 925
2002-03-17 v1.55 Tels
 * :constant picks up binary/hexadecimal constants
 * Math::BigInt->digit(123) works now
926

927 928 929
2002-03-17 v1.56 Tels
 * documented config()
 * simplified import() logic a bit
930
 * changed some isa->($upgrade) => !$isa->($self);
931

932 933 934
2002-05-30 v1.57 Tels
 * fixed objectify() to make "perl -Mbigrat -le 'print 1+2/3'" work
 * added bmodpow() and bmodinv() as (not-working yet) stubs
935

936 937
2002-06-09 v1.58 Tels
 * invalid inputs with two dot's (1.2.3 or 1..2 etc) are now really invalid
938

939 940 941 942
2002-06-10 v1.59 Tels
 * pod fixes for bmodpow()/bmodinv()
 * fix in as_hex() and as_bin() for older Perls
 * speedups in bpow(), bmodin() and bmodpow()
943

944 945
2002-07-07 v1.60 Tels
 * shortcuts to avoid calls to objectify for add/sub/mul/div/mod/pow/bcmp etc
946
 * fix overloaded bcmp() so that the objectify()-avoidance kicks in
947 948 949
 * avoid calling round() when BigFloat requested 'no rounding please'
 * bcmp()'s shortcut for comparing x <=> 0, 0 <=> 0, 0 <=> $y was making things
   slower than just handing the compare to Calc. Even more so for Pari et al.
950
 * $x->accuracy() and $x->precision() returned undef, instead of 0 if
951 952 953 954 955
   A/P of $x was 0 and global A/P was undef.
 * $x->bmod() did not modify $x in place when returning NaN/inf/-inf
 * some binary ops (band/bxor/bior/bpow) were not properly rounding the result
   to the requested A/P/R; the same ops also forgot to take $y into account
 * doc for accuracy()/precision()
956

957 958 959 960 961 962
2002-08-13 v1.61 Tels
 * tests for bsstr()/numify() with negative/special inputs
 * bround() keeps $scale as scalar for speed and less problems
 * fix for trailing newlines in input
 * some doc fixes (especially return values of is_foo() methods)
 * make testsuite so that it will pass under FastCalc easily
963

964 965
2002-08-21 v1.62 Tels
 * bcmp()/bacmp() upgrade now if requested
966 967
 * bmodinv() uses an all-positive algorithm, speeding it up by about 5-8%
   and allowing to implement the same algorithm in Calc for factor 4 speedup
968

969 970 971 972
2002-09-08 v1.63 Tels
 * bsqrt() did not modify $x but returned new object when lib does not have
   a _sqrt() routine (BareCalc, BitVect and Pari are affected, Calc, FastCalc
   and GMP were not)
973

974 975 976 977 978 979 980 981 982 983 984 985 986 987
2002-11-03 v1.64 Tels
 * removed needless "my $c = ...;" statements in binf() and bnan()
 * forgot () around "$x->{_f} & MB_NEVER_ROUND"
 * bsqrt(inf) == inf, not NaN
 * $x->bdiv($x) did not round the resulting 1 properly
 * removed the shortcut testcode in bdiv() (Calc handles this now)
 * added (non-working for now) broot() method
 * changed length() to CORE::length() in two places (thanx Liz!)
 * config() can take arguments and set them, croak on wrong ones
 * config(trap_nan => 1) to manipulate former $NaNOK variable
 * config(trap_inf => 1), too
 * trap_nan/trap_inf really croak on any attempt to create an NaN/inf
 * spellings of Bigint => BigInt
 * _find_rounding_parameters(): set $a to undef if it is 0
988

989 990 991 992 993 994 995
2003-07-13 v1.65 Tels
 * document that config() can set certain values
 * replace die() with Carp::croak()
 * remove needless is_zero() check in as_bin() and as_hex(), making them
   faster, especially when under a different lib like GMP.
 * Fixed the infinite recursion in bignum. See http://xrl.us/k6y
 * fix handling of 0e999, 0e-999 etc
996

997 998 999 1000 1001 1002 1003 1004
2003-09-01 v1.66 Tels
 * document accepted inputs better
 * fix wrong upgrade and undef-parameter handling in broot()
 * implement broot() if lib doesn't have a _root() routine for $y that are
   powers of two and for small $x
 * warn if broot() cannot yet compute proper result
 * remove needless _one(): 3% speedup for binc()
 * remove needless _swap(): 1% (Calc) - 6% (GMP) speedup for overloaded math
1005

1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021
2003-12-02 v1.67 Tels
 * overload for cos/sin/exp/atan2 to make cos(Math::BigInt->new(...)) work
 * implemented blog() with a simple and fast "iterative" method
 * use _log_int() in $CALC if possible
 * cache $CALC->can(...) calls in global %CAN hash for speed
 * reorder is_zero() check for band(), bior() and bxor() to speed up the
   case for when the underlying lib has _and(), _ior() and _xor()
 * implement a new way of emulating AND, OR and XOR, this tremendously
    helps if band() et. al. are called with negative arguments
 * try to call _signed_or(), _signed_and() and _signed_xor() in lib
 * is_foobar() methods are slightly faster
 * bnot() is about 12% faster
 * bsqrt(): moved is_zero() || is_one() test out of the way => 28% faster
   for "small" values (Calc and GMP)
 * small change for overload::constant
 * bfac(): do 0 or 1 check only if CALC cannot do _fac() (thus faster)
1022
 * removed a needless _copy in bmod() with negative arguments (slightly faster)
1023

1024
2003-12-26 v1.68 Tels
1025
 * bfac(inf) is inf, not NaN
1026 1027 1028
 * added alias names: as_int() (as_number()), is_pos(), is_neg() and doc
 * factored out all the emulation code and moved it to Math::BigInt::CalcEmu
 * binary/hexadecimal input was twice as slow as v1.66 due to a typo in v1.67
1029
 * streamlined overload for boolean context (20% faster "... if $x;")
1030 1031 1032 1033 1034 1035
 * round() was missing a croak() in path testing for wrong roundmode
 * badd(): optimize away setting of sign if it is already right
 * bdec() is about 10% faster for negative numbers
 * bpow(): removed some now needless tests for 0 and 1: about 30% faster
   for small numbers
 * streamlined exponent() (parts() benefits from this, too)
1036

1037 1038 1039 1040 1041
2004-01-13 v1.69 Tels
 * bacmp(+-$x,-inf) was wrong (Thanx William T. Morgan!)
 * digit($x,$y) segfaulted under 5.6.1 if $y was a BigInt
 * blog() was missing the modify() check (breaking MBI::Constant)
 * delete $x->{_a} vs. $x->{_a} = undef to save memory
1042

1043 1044 1045 1046 1047 1048 1049 1050 1051
2004-03-12 v1.70 Tels
 * bpow() computed -X ** Y wrong for Y that are odd
 * 0 ** -Y => +inf (was NaN) due to 0 ** -Y => 1/0**Y => 1/0 => +inf
 * fixed bug in perl -Mbignum -le 'print 2 ** 46 * 3' under Bigint::Lite
   leading to "Can't use an undefined value as an ARRAY reference at
   /usr/local/lib/perl5/5.8.2/Math/BigInt/Calc.pm line 462."
 * fixed upgrading of blog() with base = undef (means: base e)
 * make the synopsis actually runnable (Thanx Paul McCarthy)
 * blcm(): handle a list of strings (instead one obj and some strings), too
1052

1053 1054 1055 1056
2004-07-08 v1.71 Tels
 * fixed bsub() failing under $x -= $x; Thanx Peter J. Acklam!
 * _scan_for_nonzero() reuses length/stringform of $x and is thus faster, this
   helps rounding if the number after the roundposition is '5'
1057

1058 1059
2004-07-13 v1.72 Tels
 * no changes
1060

1061 1062 1063 1064 1065
2004-10-10 v1.73 Tels
 * overloading of <<= and >>= makes these ops about 10% faster and fixes the
   problem that "$a <<= 2" would create a different object for $a to point to
 * quite a lot of fixes for NaN/inf handling in bpow() (bmul already did it
   right) - bug report by jeff at thekidders com and Hugo - Thank you!
1066

1067 1068 1069 1070 1071 1072 1073 1074 1075 1076
2005-01-01 v1.74 Tels
 * streamline _scale_a() and _scale_p() for more speed in rounding
 * remove the now unnec. support for MB_NEVER_ROUND and {_f}, this
   makes all ops that call round() a tad faster (one exists is
   removed) and shrinks the codesize a bit
 * streamline bneg(), inline is_zero(): makes it 1.6 times faster
 * replace ref($_[0]) w/ undef when it isn't actually needed. This
   makes some ops (bsstr(), bneg etc) about 2% faster for small numbers
 * restrict low-level math library names to sane chars to avoid
   exploitation of eval()
1077
 * fill_can_cache() accidentally did checks for 'or' & 'xor'
1078 1079 1080 1081 1082 1083
 * inline _fill_can_cache
 * add _register_callback() to notify subclasses of lower math lib changes
 * bgcd() is now about 10% faster
 * is_positive(0) == 0, since 0 is neither positive nor negative
 * streamline bmod() a bit
 * fix blog() constructing arguments (broke Math::BigInt::Constant)
1084

1085 1086 1087 1088
2005-03-20 v1.75 Tels
 * use a trick to remove the dependency on Scalar::Util in bsub()
 * fix atan2(), it did not preserve the order of arguments
   (Thanx to Ambros & Zaxo for report and patch!)
1089

1090 1091 1092 1093
2005-04-10 v1.76 Tels
 * fix rounding doc, add notes about prevision vs. accuracy
 * trap inf and -inf in new()
 * load FastCalc as default
1094

1095 1096
2005-05-17 v1.77 Tels
 * bump version
1097

1098 1099 1100 1101 1102 1103 1104 1105 1106 1107
2007-01-27 v1.78 Tels
 * implement "try" and "only" as replacements for "lib"
 * make 'use Math::BigInt lib => "foo"' warn if foo cannot be loaded and a
   fallback occurs
 * fix bug #21446 - Docs/code inconsistency for bnorm() method
 * fix bug #21964 - A patch to include a rounding mode of 'common'
 * fix bug #21445 - Documentation error for exponent() method
 * fix bug perl #41050 - NaN returned when raising integer value to negative power
 * add from_hex(), from_oct(), and from_bin()
 * add as_oct()
1108

1109 1110
2007-02-02 v1.79 Tels
 * fix typos
1111

1112 1113 1114 1115 1116 1117 1118
2007-03-04 v1.80 Tels
 * require Perl v5.6.2 as minimum
 * fix bug #24969 (Can't use an undefined value as an ARRAY reference)
 * fix bug #12857: Subclasses and overload
 * fix bug #13866: NaN (in bignum queue)
 * fix bug #21586: Incorrect result when comparing with NaN
 * fix bug #15896: "==" overloading is broken for "NaN"
1119

1120 1121
2007-03-16 v1.81 Tels
 * no code change, just a package update
1122

1123 1124 1125 1126 1127
2007-04-09 v1.82 Tels
 * use $CALC->_zeros() directly (instead _trailing_zeros()) to speed up
   exponent() and mantissa()
 * fix documentation that blsft() and brsft() default to base 2 (not 10)
 * add bexp() and fix overloading for exp()
1128

1129 1130
2007-04-16 v1.83 Tels
 * bump version
1131

1132 1133
2007-05-04 v1.84 Tels
 * add bnok() method (n over k)
1134

1135 1136
2007-05-05 v1.85 Tels
 * bump version
1137

1138 1139
2007-05-05 v1.86 Tels
 * bump version
1140

1141 1142 1143 1144 1145 1146 1147 1148
2007-06-30 v1.87 Tels
 * fix undef base in blog()
 * support config('lib') as shortcut for config()->{lib}
 * _find_round_parameters(): convert $a & $p to normal scalars, or bad
   things will happen during rounding of BigFloats
 * add bpi(), bcos(), bsin(), batan(), batan2() methods
 * add bmuladd()
 * streamline the is_xxx() and copy() methods
1149

1150 1151 1152 1153 1154
2007-09-22 v1.88 Tels
 * fix wide ints on Perl v5.8.0 (Thanx zefram!)
 * minimum required is Perl v5.6 (tested by zefram)
 * _find_round_parameters(), _scale_a() and _scale_p(): trunc A/P to integers
 * fix from_oct(), from_bin() and from_hex()
1155

1156 1157
2008-04-20 v1.89 Tels
 * fix #35238: batan2() handles inf/+inf wrong
1158

1159 1160
2010-09-03 v1.90 rafl
 * fix bnok() for k==0 and k==n-1
1161

1162 1163
2010-09-10 v1.91 rafl
 * fix various documentation bugs
1164

1165 1166
2010-09-10 v1.92 rafl
 * re-upload v1.91 with a fixed SIGNATURE
1167

1168 1169 1170 1171
2010-09-13 v1.93 rafl
 * Depend on perl >= 5.6.2
 * Remove obsolete core test directory boilerplate
 * Convert from Test to Test::More
1172

1173 1174
2010-09-13 v1.94 rafl DEVELOPMENT RELEASE
 * Attempt to fix Math::BigInt::Lite failures
1175

1176 1177
2010-09-14 v1.95 rafl
 * Re-upload v1.94 as a stable release
1178

1179 1180
2010-09-28 v1.96 rafl
 * Various documentation fixes provided by gregor herrmann
1181

1182 1183 1184 1185
2010-11-07 v1.97 rafl
 * Reorder the list return of Math::BigInt::Calc::_base_len() (Nicholas Clark)
   This change requires an update of Math::BigInt::FastCalc to version 0.24.
 * Fix segfault when upgrading irrational numbers (Father Chrysostomos)
1186

1187 1188 1189 1190 1191 1192 1193
2010-11-08 v1.98 rafl
 * Fix from_bin() documentation error (Peter John Acklam) (Closes: RT#61845).
 * Make as_int($inf) return inf, not NaN (Peter John Acklam) (Closes RT#62101).
 * Fix various typos in documentation and tests (Peter John Acklam)
   (Closes RT#62643).
 * Make digit($n) return 0 for "out of range"-digits (Peter John Acklam)
   (Closes RT#61812).
1194

1195 1196 1197 1198 1199 1200 1201
2010-11-15 v1.99 rafl
 * Stop as_int/as_number from losing precision (Peter John Acklam)
   (Closes: RT#43694)
 * Fix Math::BigInt::Calc::_modpow for (0 ** $x) % $y, with $x > 0
   (Peter John Acklam) (Closes: RT#62918).
 * Stop $x -> bmodpow(1, 1) from failing when $x is large (Peter John Acklam)
   (Closes: RT#62949).
1202

1203 1204 1205
##############################################################################
The changes are now grouped by distribution.

1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217
2011-01-29 v1.99_05 pjacklam
 * Fix typos (reminder -> remainder etc.) (Peter John Acklam)
 * Fix Math::BigInt::Calc::_num returning NaN, not Inf, when it overflowed
   (Peter John Acklam) (Closes: RT #25274).
 * Fix Math::BigFloat->bcmp() so it can handle arbitrarily large exponents
   (Peter John Acklam) (Closes: RT #62764).
 * Fix bmodpow() in Math::BigInt 1.99 mis-calculating powers of one
   (Peter John Acklam) (Closes: RT #63237).
 * Fix bmodpow() and bmodinv() in Math::BigInt to handle negative input
   (Peter John Acklam) (Closes: RT #61543)
 * Clean up whitespace (Nicholas Clark).
 * Added file t/00-signature.t for testing SIGNATURE (Peter John Acklam).
1218

1219 1220 1221 1222 1223
2011-02-05 v1.991 pjacklam
 * Add workaround for library inconsistencies (Math::BigInt::Calc vs.
   Math::BigInt::GMP). This makes older versions of Math::BigInt::GMP
   work with latest version of Math::BigInt (Peter John Acklam).
 * Correct and extend API documentation (Peter John Acklam).
1224

1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248
2011-02-18 v1.992 pjacklam
 * Math::BigInt::Calc->_nok(): Use symmetry property nok(n,k) = nok(n,n-k) to
   speed up execution when k is large. Also general code cleanup. (Peter John
   Acklam).
 * Math::BigInt::Calc->_gcd(): Speed up by reducing amount of data copying
   (Peter John Acklam).
 * Add '01load.t' for basic module loading and diagnostics useful for
   debugging. Rename '00-signature.t' to '00sig.t', 'pod.t' to '02pod.t', and
   'pod_cov.t' to '03podcov.t' (Peter John Acklam).
 * Math::BigInt:: Make from_hex(), from_oct(), and behave more like hex() and
   oct() in the Perl core, and make from_bin() consistent with from_hex() and
   from_oct() (this is related to RT #58954) (Peter John Acklam).
 * Math::BigInt::Calc->_rem(): Modify first input arg always, not just
   sometimes (Peter John Acklam).
 * Math::BigInt::Calc->_modinv(): be more consistent with the _modinv() method
   in other libraries (Math::BigInt::GMP, etc.) (Peter John Acklam)
 * Math::BigInt::Calc->_nok(): use symmetry property nok(n,k) = nok(n,n-k).
   This cuts computation time tremendously when n and k are large (Peter John
   Acklam).
 * Math::BigInt::Calc->_gcd(): quickly handle zero cases, avoid code
   duplication, and always modify the first input argument in-place (Peter John
   Acklam).
 * Clean up code and add more code comments (Peter John Acklam).
 * Fix typos (Peter John Acklam).
1249

1250 1251 1252 1253
2011-02-26 v1.993 pjacklam
 * Change default backend library from Math::BigInt::FastCalc to
   Math::BigInt::Calc, which is included in the Math-BigInt distro. This
   avoids recursive distribution dependency (RT #65976) (Peter John Acklam).
1254

1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270
2011-09-04 v1.997 pjacklam
 * Document actual behaviour of from_xxx() methods. [perl #85334] (Peter John
   Acklam)
 * Make bmuladd() able to handle third arg properly. [perl #85482] (Peter John
   Acklam)
 * Add sign function bsgn() as a complement to babs(). (Peter John Acklam)
 * Fix objectify()'s handling of "foreign objects". (RT #16221 and #52124)
   (Peter John Acklam)
 * Rewrap some verbatim pod in Math::BigInt. (Father Chrysostomos)
 * Correct links to sections. (Alexandr Ciornii)
 * Remove incorrect formatting inside verbatim paragraphs. (Alexandr Ciornii)
 * Upgrade bundled modules in "inc" to latest version. (Peter John Acklam)
 * Include "^MYMETA\.(yml|json)\z" in MANIFEST.SKIP. Whereas META.* are
   generated by the distribution author at packaging time, MYMETA.* are
   generated by the end user at configure time after any dynamic dependencies
   are known. (Peter John Acklam)
1271

1272
2014-04-03 v1.9993 pjacklam
1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354
 BUGS
  * Add reference to CPAN RT for the Math-BigInt distro.
 CHANGES
  * Add recent changes.
 examples/hailstone.pl
  * Remove this file as it doesn't seem to be working.
 lib/Math/BigFloat.pm
  * Correct spelling errors.
  * Reformat code to avoid long lines.
  * Improve POD formatting.
  * Add meta-documentation (CPAN ratings, CPAN testers matrix, etc.)
  * Add the bint() method.
 lib/Math/BigInt.pm
  * Correct spelling errors.
  * Reformat code to avoid long lines.
  * Improve POD formatting.
  * Add meta-documentation (CPAN ratings, CPAN testers matrix, etc.)
  * Add the bint() method.
  * Remove references to the obsolete Math::Big
 lib/Math/BigInt/Calc.pm
  * Correct spelling errors.
  * Added meta-documentation (CPAN ratings, CPAN testers matrix, etc.)
 lib/Math/BigInt/CalcEmu.pm
  * Correct spelling errors.
  * Improve POD formatting.
  * Add meta-documentation (CPAN ratings, CPAN testers matrix, etc.)
  * Remove references to Math::BigInt::BitVect, which is no longer on CPAN.
 Makefile.PL
  * Remove code that checks for compatible versions of distributions that
    depend on Math-BigInt. Such checking should be done in the distributions
    that depend on Math-BigInt, not in Math-BigInt itself.
 NEW
  * This file now only refers to the change log.
 t/bigfltpm.inc
  * Add tests for fint().
 t/bigintpm.inc
  * Add tests for int().
 t/upgrade.inc
  * Add tests for int().
 t/*.t
  * Increment test counts as needed for the new tests in the t/*.inc files.
 inc/Module/Install*
  * Upgrade bundled Module::Install from version 1.01 to version 1.08.

2015-08-10 v1.9994 pjacklam
 CHANGES
  * Add recent changes.
 lib/Math/BigFloat.pm
  * Fix blog() which sometimes returns incorrect result.
  * bdiv() in list context now returns the integer quotient and the remainder.
 t/bigfltpm.inc
  * Modify tests for blog() in list context.
 t/biglog.t
  * Change incorrect use of ok() to is().
 t/upgrade.inc
  * Modify tests for blog() in list context.
 inc/Module/Install*
  * Upgrade bundled Module::Install from version 1.08 to version 1.16.

2015-08-11 v1.9995 pjacklam
 CHANGES
  * Move changes that were incorrectly reported as being for the release 1.9994
    when they were in fact for release 1.9993.
  * Add changes both for release 1.9994 and 1.9995.
 lib/Math/BigInt.pm
  * Break lines to avoid lines with more than 80 characters.
  * Improve objectify() for better handling of subclasses.

2015-08-12 v1.9996 pjacklam
 CHANGES
  * Add recent changes.
  * Use present tense in change descriptions.
 lib/Math/BigInt.pm
  * Change incorrect use of ok() to is() in example.

2015-08-12 v1.9997 pjacklam
 CHANGES
  * Add recent changes.
 t/bigintpm.inc
  * Correct spelling errors.
 t/upgrade.inc
  * Correct spelling errors.
1355

1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391
2015-09-11 v1.999701 pjacklam

 * The POD documentation, as well as the comments in the code, said that
   $x->bdiv($y) in list context should return quotient $q and remainder $r so
   that $x = $q * $y + $r, and that the remainder (modulo) $r should correspond
   to Perl's % operator as well as the bmod() method. This has not been the
   actual behaviour. This is now fixed.

 * Clearer POD documentation for the bdiv() and bmod() methods.

 * All input values in the range (-1,1) written as a decimal number, e.g.,
   -0.75 and 0.5, now return NaN, not 0.

 * Input values with a large (absolute value) negative exponent, e.g.,
   1e-9999999, now return NaN. The former behaviour was to die with the message
   "Quantifier in {,} bigger than 32766 in regex; marked by ..."

 * Intermediate computations in blog() increased the number of digits
   significantly in some cases. Now reduce the number of digits by rounding.
   However, keep some extra digits for remaining intermediate computations
   before the final rounding.

 * When $x is a Math::BigFloat, $x -> bceil() and $x -> bint() for -1 < $x < 0
   returned -0. Negative zero is never used by Math::Big(Int|Float), and care
   has been taken to avoid it, so this bug is surely an oversight.

 * Explicitly specify the backend (lib => 'Calc') in t/mbimbf.t for easier
   release management of the backend distributions.

 * Add "use warnings" to test scripts, since Perl 5.6.2 is required anyway, and
   "use warnings" was introduced in Perl 5.6.1.

 * Modified test scripts so the difference between the test files in the
   Math-BigInt distribution and the backend distributions are as few and as
   small as possible. This makes for easier release management.

1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420
2015-09-17 v1.999702 pjacklam

 * The overloaded log() is a unary operator, so don't pass additional
   arguments.

 * Fix blog() so the cases $x->blog() and $x->blog(undef) work correctly. An
   undefined base means that blog() should use base e (Euler's number).

 * Both CORE::log() and other mathematical software returns inf for log(inf),
   so we do the same.

 * Add tests for log() as well as templates for future tests of the other
   overloadable functions.

 * Improve descriptions of a few tests.

2015-09-21 v1.999703 pjacklam

 * Fix blog() in Math::BigInt and Math::BigFloat to work correctly regardless
   of the base.

 * Correct existing tests in bigintpm.inc and bigfltpm.inc.

 * Update test plans (number of tests) in t/bare_mbi.t, t/bigintpm.t, and
   t/sub_mbi.t.

 * Add test files t/blog-mbf.t and t/blog-mbi.t for better testing of the
   blog() methods.

1421 1422
Please send us test-reports, your experiences with this and your ideas - we love
to hear about our work!
1423

1424
The Math-BigInt developers <bignum@lists.scsys.co.uk>