Math::GMP
Native Rust implementation built into the interpreter. Runtime: PP. See original documentation for the full Perl reference.
Math::GMP — High-speed arbitrary precision integers
This is the Perl-facing frontend for Peta::FFI::GMP. It:
- Triggers
Peta::FFI::GMP::register()to load libgmp and wire up all ops - Registers the overloaded operators for the Math::GMP class
- Implements
Math::GMP::new()with its argument parsing logic - Registers aliases: gcd → bgcd, lcm → blcm, DESTROY → destroy
All arithmetic, comparison, and utility functions are already registered under Math::GMP::* by Peta::FFI::GMP::register(), so we only add the Perl-level glue here.
Functions
new
Constructs a new Math::GMP object from a string, integer, or existing Math::GMP.
use Math::GMP;
my $n = Math::GMP->new("123456789012345678901234567890");
my $hex = Math::GMP->new("ff", 16);
See also: new_from_scalar, new_from_scalar_with_base, gmp_copy