# Math::BigInt::Calc - man - phpman

## NAME
    [Math::BigInt::Calc](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3ACalc/markdown) - pure Perl module to support [Math::BigInt](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt/markdown)

## SYNOPSIS
        # to use it with [Math::BigInt](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt/markdown)
        use [Math::BigInt](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt/markdown) lib => 'Calc';

        # to use it with [Math::BigFloat](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigFloat/markdown)
        use [Math::BigFloat](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigFloat/markdown) lib => 'Calc';

        # to use it with [Math::BigRat](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigRat/markdown)
        use [Math::BigRat](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigRat/markdown) lib => 'Calc';

        # explicitly set base length and whether to "use integer"
        use [Math::BigInt::Calc](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3ACalc/markdown) base_len => 4, use_int => 1;
        use [Math::BigInt](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt/markdown) lib => 'Calc';

## DESCRIPTION
    [Math::BigInt::Calc](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3ACalc/markdown) inherits from [Math::BigInt::Lib](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3ALib/markdown).

    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](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3ACalc/markdown) 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](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3ACalc/markdown) use_int => 1;   # use "use integer" internally

## METHODS
    This overview constains only the methods that are specific to "[Math::BigInt::Calc](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3ACalc/markdown)". For the
    other methods, see [Math::BigInt::Lib](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3ALib/markdown).

    _base_len()
        Specify the desired base length and whether to enable "use integer" in the computations.

            [Math::BigInt::Calc](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3ACalc/markdown) -> _base_len($base_len, $use_int);

        Note that it is better to specify the base length and whether to use integers as options
        when the module is loaded, for example like this

            use [Math::BigInt::Calc](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3ACalc/markdown) base_len => 6, use_int => 1;

## SEE ALSO
    [Math::BigInt::Lib](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3ALib/markdown) for a description of the API.

    Alternative libraries [Math::BigInt::FastCalc](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3AFastCalc/markdown), [Math::BigInt::GMP](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3AGMP/markdown), [Math::BigInt::Pari](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3APari/markdown),
    [Math::BigInt::GMPz](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3AGMPz/markdown), and [Math::BigInt::BitVect](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt%3A%3ABitVect/markdown).

    Some of the modules that use these libraries [Math::BigInt](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigInt/markdown), [Math::BigFloat](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigFloat/markdown), and [Math::BigRat](https://www.chedong.com/phpMan.php/perldoc/Math%3A%3ABigRat/markdown).

