1Math::BigInt::Calc(3) User Contributed Perl DocumentationMath::BigInt::Calc(3)
2
3
4
6 Math::BigInt::Calc - pure Perl module to support Math::BigInt
7
9 # to use it with Math::BigInt
10 use Math::BigInt lib => 'Calc';
11
12 # to use it with Math::BigFloat
13 use Math::BigFloat lib => 'Calc';
14
15 # to use it with Math::BigRat
16 use Math::BigRat lib => 'Calc';
17
18 # explicitly set base length and whether to "use integer"
19 use Math::BigInt::Calc base_len => 4, use_int => 1;
20 use Math::BigInt lib => 'Calc';
21
23 Math::BigInt::Calc inherits from Math::BigInt::Lib.
24
25 In this library, the numbers are represented interenally in base B =
26 10**N, where N is the largest possible integer that does not cause
27 overflow in the intermediate computations. The base B elements are
28 stored in an array, with the least significant element stored in array
29 element zero. There are no leading zero elements, except a single zero
30 element when the number is zero. For instance, if B = 10000, the number
31 1234567890 is represented internally as [7890, 3456, 12].
32
34 When the module is loaded, it computes the maximum exponent, i.e.,
35 power of 10, that can be used with and without "use integer" in the
36 computations. The default is to use this maximum exponent. If the
37 combination of the 'base_len' value and the 'use_int' value exceeds the
38 maximum value, an error is thrown.
39
40 base_len
41 The base length can be specified explicitly with the 'base_len'
42 option. The value must be a positive integer.
43
44 use Math::BigInt::Calc base_len => 4; # use 10000 as internal base
45
46 use_int
47 This option is used to specify whether "use integer" should be used
48 in the internal computations. The value is interpreted as a boolean
49 value, so use 0 or "" for false and anything else for true. If the
50 'base_len' is not specified together with 'use_int', the current
51 value for the base length is used.
52
53 use Math::BigInt::Calc use_int => 1; # use "use integer" internally
54
56 This overview constains only the methods that are specific to
57 "Math::BigInt::Calc". For the other methods, see Math::BigInt::Lib.
58
59 _base_len()
60 Specify the desired base length and whether to enable "use integer"
61 in the computations.
62
63 Math::BigInt::Calc -> _base_len($base_len, $use_int);
64
65 Note that it is better to specify the base length and whether to
66 use integers as options when the module is loaded, for example like
67 this
68
69 use Math::BigInt::Calc base_len => 6, use_int => 1;
70
72 Math::BigInt::Lib for a description of the API.
73
74 Alternative libraries Math::BigInt::FastCalc, Math::BigInt::GMP,
75 Math::BigInt::Pari, Math::BigInt::GMPz, and Math::BigInt::BitVect.
76
77 Some of the modules that use these libraries Math::BigInt,
78 Math::BigFloat, and Math::BigRat.
79
80
81
82perl v5.34.0 2021-09-22 Math::BigInt::Calc(3)