1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "Math::BigInt::Calc 3perl"
.TH Math::BigInt::Calc 3perl 2024-05-30 "perl v5.38.2" "Perl Programmers Reference Guide"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
Math::BigInt::Calc \- pure Perl module to support Math::BigInt
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 2
\& # to use it with Math::BigInt
\& use Math::BigInt lib => \*(AqCalc\*(Aq;
\&
\& # to use it with Math::BigFloat
\& use Math::BigFloat lib => \*(AqCalc\*(Aq;
\&
\& # to use it with Math::BigRat
\& use Math::BigRat lib => \*(AqCalc\*(Aq;
\&
\& # explicitly set base length and whether to "use integer"
\& use Math::BigInt::Calc base_len => 4, use_int => 1;
\& use Math::BigInt lib => \*(AqCalc\*(Aq;
.Ve
.SH DESCRIPTION
.IX Header "DESCRIPTION"
Math::BigInt::Calc inherits from Math::BigInt::Lib.
.PP
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].
.SH OPTIONS
.IX Header "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.
.IP base_len 4
.IX Item "base_len"
The base length can be specified explicitly with the 'base_len' option. The
value must be a positive integer.
.Sp
.Vb 1
\& use Math::BigInt::Calc base_len => 4; # use 10000 as internal base
.Ve
.IP use_int 4
.IX Item "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.
.Sp
.Vb 1
\& use Math::BigInt::Calc use_int => 1; # use "use integer" internally
.Ve
.SH METHODS
.IX Header "METHODS"
This overview constains only the methods that are specific to
\&\f(CW\*(C`Math::BigInt::Calc\*(C'\fR. For the other methods, see Math::BigInt::Lib.
.IP \fB_base_len()\fR 4
.IX Item "_base_len()"
Specify the desired base length and whether to enable "use integer" in the
computations.
.Sp
.Vb 1
\& Math::BigInt::Calc \-> _base_len($base_len, $use_int);
.Ve
.Sp
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
.Sp
.Vb 1
\& use Math::BigInt::Calc base_len => 6, use_int => 1;
.Ve
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Math::BigInt::Lib for a description of the API.
.PP
Alternative libraries Math::BigInt::FastCalc, Math::BigInt::GMP,
Math::BigInt::Pari, Math::BigInt::GMPz, and Math::BigInt::BitVect.
.PP
Some of the modules that use these libraries Math::BigInt,
Math::BigFloat, and Math::BigRat.
|