Math::BigInt

From HalfgeekKB
Revision as of 10:15, 2 April 2005 by 161.253.9.181 (talk)
Jump to navigation Jump to search

Use

Specifying lib forces a library, but if that library isn't installed, fallback is automatic.

use Math::BigInt lib => 'GMP';

In-place Modification

Modification is in-place, regardless of context. A new object is not created for a result.

use Math::BigInt;

# Void context

my $a = new Math::BigInt '27';
$a->badd(3);

print "$a"; # 30

# Scalar context

my $b = new Math::BigInt '27';
my $c = $b->badd(3);

print "$b"; # 30
print "$c"; # 30
print $b == $c ? "Same object" : "Not same object";
  # Same object

Converting a binary string to a BigInt

# Code here...



See Also