Allows use of arbitrary length integers, in which the following apply to all methods, except as noted:
The object $i remains unchanged.
Big integer strings (bints) have the form /^\s*[+-]?[\d\s]+$/.
All methods except bcmp return a big integer string or strings.
Embedded whitespace is ignored.
Output values are always in the canonical form: /^[+-]\d+$/.
The return value NaN results when an input argument is not a number, or when a divide by zero is attempted.
new |
$i = Math::BigInt->new(string)
Creates a new object, $i.
babs |
$i->babs
Returns absolute value of $i.
badd |
$i->badd(bint)
Returns sum of bint and $i.
bcmp |
$i->bcmp(bint)
Compares $i to bint. The bcmp method returns -1, 0, or 1 depending on whether $f is less than, equal to, or greater than the number string given as an argument. If the number string is undefined or null, undef is returned.
bdiv |
$i->bdiv(bint)
Returns $i divided by bint. In list context, returns a two-element array containing the quotient of the division and the remainder; in scalar context, returns only the quotient.
bgcd |
$i->bgcd(bint)
Returns greatest common divisor of $i and bint.
bmod |
$i->bmod(bint)
Returns $i modulus bint.
bmul |
$i->bmul(bint)
Returns $i multiplied by bint.
bneg |
$i->bneg
Returns negative of $i.
bnorm |
$i->bnorm
Returns normalization of $i.
bsub |
$i->bsub(bint)
Returns $i minus bint.
Copyright © 2002 O'Reilly & Associates. All rights reserved.