You are viewing the version of this documentation from Perl blead. This is a development release of Perl.

CONTENTS

NAME

Math::BigInt::Calc - pure Perl module to support Math::BigInt

SYNOPSIS

# 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';

DESCRIPTION

Math::BigInt::Calc inherits from Math::BigInt::Lib.

In this library, the numbers are represented interenally in base B = 10**N, where N is the largest possible integer that does not cause overflow in the intermediate computations. The base B elements are stored in an array, with the least significant element stored in array element zero. There are no leading zero elements, except a single zero element when the number is zero. For instance, if B = 10000, the number 1234567890 is represented internally as [7890, 3456, 12].

OPTIONS

When the module is loaded, it computes the maximum exponent, i.e., power of 10, that can be used with and without "use integer" in the computations. The default is to use this maximum exponent. If the combination of the 'base_len' value and the 'use_int' value exceeds the maximum value, an error is thrown.

base_len

The base length can be specified 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 option is used to specify whether "use integer" should be used in the internal computations. The value is interpreted as a boolean value, so use 0 or "" for false and anything else for true. If the 'base_len' is not 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

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, and Math::BigInt::BitVect.

Some of the modules that use these libraries Math::BigInt, Math::BigFloat, and Math::BigRat.