MATH::BIGINT::CALC(3pm)
π Math::BigInt::Calc
okay so bestie, this is a manual page for the module Math::BigInt::Calc β it's the pure Perl module that supports Math::BigInt. no cap, it's the backend that does the actual number crunching when you don't have some fancy compiled library loaded. π«Ά
πΈ SYNOPSIS πΈ
here's how you'd actually use it, in all the ways:
# to use it with Math::BigInt
use Math::BigInt lib => 'Calc';
# to use it with Math::BigFloat
use Math::BigFloat lib => 'Calc';
# to use it with Math::BigRat
use Math::BigRat lib => 'Calc';
# explicitly set base length and whether to "use integer"
use Math::BigInt::Calc base_len => 4, use_int => 1;
use Math::BigInt lib => 'Calc';
like literally just pick your vibe and go β¨
π DESCRIPTION π
Math::BigInt::Calc inherits from Math::BigInt::Lib. family tree moment π
so the way this library works: numbers are represented internally in base B = 10**N, where N is the largest possible integer that doesn't cause overflow in the intermediate computations. it's giving "maximum safe vibes" π¦
the base B elements live in an array, and the least significant element is stored in array element zero. like, index 0 is the littlest guy. humbling. there are no leading zero elements β except a single zero element when the number is zero (iconic exception, we stan) π
for instance, if B = 10000, the number 1234567890 is represented internally as [7890, 3456, 12].
see how it's chunked up? ate and left no crumbs π
β¨ OPTIONS β¨
when the module is loaded, it computes the maximum exponent β i.e. the power of 10 β that can be used with and without "use integer" in the computations. the default is to use this maximum exponent. π₯
β οΈ heads up bestie: if the combination of the'base_len'value and the'use_int'value exceeds the maximum value, an error is thrown. not a drill, it will literally fail on you π
π base_len
you can specify the base length explicitly with the 'base_len' option. the value must be a positive integer.
use Math::BigInt::Calc base_len => 4; # use 10000 as internal base
π use_int
this one's for saying whether "use integer" should be used in the internal computations. the value is interpreted as a boolean, so use 0 or "" for false, and literally anything else for true. π
if 'base_len' isn't specified together with 'use_int', the current value for the base length is used.
use Math::BigInt::Calc use_int => 1; # use "use integer" internally
π METHODS π
okay so this overview contains only the methods that are specific to Math::BigInt::Calc. for the other methods, go look at Math::BigInt::Lib (iykyk) π
π¦ _base_len()
specify the desired base length and whether to enable "use integer" in the computations.
Math::BigInt::Calc -> _base_len($base_len, $use_int);
π‘ lowkey important: it's better to specify the base length and whether to use integers as options when the module is loaded, like this:
use Math::BigInt::Calc base_len => 6, use_int => 1;
main character energy is passing the options at load time, not calling the method later. periodt. π
π SEE ALSO π
Math::BigInt::Libβ for a description of the API.- alternative libraries:
Math::BigInt::FastCalc,Math::BigInt::GMP,Math::BigInt::Pari,Math::BigInt::GMPz, andMath::BigInt::BitVect. β¨ - some of the modules that use these libraries:
Math::BigInt,Math::BigFloat, andMath::BigRat. π«Ά
and that's the whole page, bestie π this was perl v5.42.3, dated 2026-11-03 β so go forth, chunk your digits in base 10**N, and slay πΈπ§β
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms