This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade bignum from version 0.40 to 0.41
[perl5.git] / cpan / bignum / lib / bignum.pm
CommitLineData
126f3c5f 1package bignum;
9de9b613 2use 5.006;
126f3c5f 3
c6824fe7 4$VERSION = '0.41';
126f3c5f 5use Exporter;
56e812ab
PJA
6@ISA = qw( bigint );
7@EXPORT_OK = qw( PI e bexp bpi hex oct );
8@EXPORT = qw( inf NaN );
126f3c5f
JH
9
10use strict;
95a2d02c 11use overload;
6aa4fbb5 12use bigint ();
126f3c5f 13
56e812ab 14##############################################################################
126f3c5f 15
56e812ab
PJA
16BEGIN {
17 *inf = \&bigint::inf;
18 *NaN = \&bigint::NaN;
19 *hex = \&bigint::hex;
20 *oct = \&bigint::oct;
21}
d1a15766 22
126f3c5f
JH
23# These are all alike, and thus faked by AUTOLOAD
24
25my @faked = qw/round_mode accuracy precision div_scale/;
56e812ab
PJA
26use vars qw/$VERSION $AUTOLOAD $_lite/; # _lite for testsuite
27
28sub AUTOLOAD {
29 my $name = $AUTOLOAD;
30
31 $name =~ s/.*:://; # split package
32 no strict 'refs';
33 foreach my $n (@faked) {
34 if ($n eq $name) {
35 *{"bignum::$name"} =
36 sub {
37 my $self = shift;
38 no strict 'refs';
39 if (defined $_[0]) {
40 Math::BigInt->$name($_[0]);
41 return Math::BigFloat->$name($_[0]);
42 }
43 return Math::BigInt->$name();
44 };
45 return &$name;
46 }
126f3c5f 47 }
126f3c5f 48
56e812ab
PJA
49 # delayed load of Carp and avoid recursion
50 require Carp;
51 Carp::croak ("Can't call bignum\-\>$name, not a valid method");
52}
4440d13a 53
56e812ab
PJA
54sub unimport {
55 $^H{bignum} = undef; # no longer in effect
56 overload::remove_constant('binary', '', 'float', '', 'integer');
57}
58
59sub in_effect {
60 my $level = shift || 0;
61 my $hinthash = (caller($level))[10];
62 $hinthash->{bignum};
63}
4440d13a 64
d1a15766 65#############################################################################
d1a15766 66
56e812ab
PJA
67sub import {
68 my $self = shift;
126f3c5f 69
56e812ab 70 $^H{bignum} = 1; # we are in effect
4440d13a 71
56e812ab
PJA
72 # for newer Perls override hex() and oct() with a lexical version:
73 if ($] > 5.009004) {
74 bigint::_override();
d1a15766
T
75 }
76
56e812ab
PJA
77 # some defaults
78 my $lib = '';
79 my $lib_kind = 'try';
80 my $upgrade = 'Math::BigFloat';
81 my $downgrade = 'Math::BigInt';
82
83 my @import = (':constant'); # drive it w/ constant
84 my @a = @_;
85 my $l = scalar @_;
86 my $j = 0;
87 my ($ver, $trace); # version? trace?
88 my ($a, $p); # accuracy, precision
89 for (my $i = 0; $i < $l; $i++, $j++) {
90 if ($_[$i] eq 'upgrade') {
91 # this causes upgrading
92 $upgrade = $_[$i + 1]; # or undef to disable
93 my $s = 2;
94 $s = 1 if @a - $j < 2; # avoid "can not modify non-existent..."
95 splice @a, $j, $s;
96 $j -= $s;
97 $i++;
98 } elsif ($_[$i] eq 'downgrade') {
99 # this causes downgrading
100 $downgrade = $_[$i + 1]; # or undef to disable
101 my $s = 2;
102 $s = 1 if @a - $j < 2; # avoid "can not modify non-existent..."
103 splice @a, $j, $s;
104 $j -= $s;
105 $i++;
106 } elsif ($_[$i] =~ /^(l|lib|try|only)$/) {
107 # this causes a different low lib to take care...
108 $lib_kind = $1;
109 $lib_kind = 'lib' if $lib_kind eq 'l';
110 $lib = $_[$i + 1] || '';
111 my $s = 2;
112 $s = 1 if @a - $j < 2; # avoid "can not modify non-existent..."
113 splice @a, $j, $s;
114 $j -= $s;
115 $i++;
116 }
117 elsif ($_[$i] =~ /^(a|accuracy)$/) {
118 $a = $_[$i + 1];
119 my $s = 2;
120 $s = 1 if @a - $j < 2; # avoid "can not modify non-existent..."
121 splice @a, $j, $s;
122 $j -= $s;
123 $i++;
124 }
125 elsif ($_[$i] =~ /^(p|precision)$/) {
126 $p = $_[$i + 1];
127 my $s = 2;
128 $s = 1 if @a - $j < 2; # avoid "can not modify non-existent..."
129 splice @a, $j, $s;
130 $j -= $s;
131 $i++;
132 }
133 elsif ($_[$i] =~ /^(v|version)$/) {
134 $ver = 1;
135 splice @a, $j, 1;
136 $j--;
137 }
138 elsif ($_[$i] =~ /^(t|trace)$/) {
139 $trace = 1;
140 splice @a, $j, 1;
141 $j--;
142 }
143 elsif ($_[$i] !~ /^(PI|e|bexp|bpi|hex|oct)\z/) {
144 die ("unknown option $_[$i]");
145 }
126f3c5f 146 }
56e812ab
PJA
147 my $class;
148 $_lite = 0; # using M::BI::L ?
149 if ($trace) {
150 require Math::BigInt::Trace;
151 $class = 'Math::BigInt::Trace';
152 $upgrade = 'Math::BigFloat::Trace';
126f3c5f 153 }
56e812ab
PJA
154 else {
155 # see if we can find Math::BigInt::Lite
156 if (!defined $a && !defined $p) { # rounding won't work to well
157 if (eval { require Math::BigInt::Lite; 1 }) {
158 @import = (); # :constant in Lite, not MBI
159 Math::BigInt::Lite->import(':constant');
160 $_lite = 1; # signal okay
161 }
126f3c5f 162 }
56e812ab
PJA
163 require Math::BigInt if $_lite == 0; # not already loaded?
164 $class = 'Math::BigInt'; # regardless of MBIL or not
233f7bc0 165 }
56e812ab
PJA
166 push @import, $lib_kind => $lib if $lib ne '';
167 # Math::BigInt::Trace or plain Math::BigInt
168 $class->import(@import, upgrade => $upgrade);
169
170 if ($trace) {
171 require Math::BigFloat::Trace;
172 $class = 'Math::BigFloat::Trace';
173 $downgrade = 'Math::BigInt::Trace';
126f3c5f 174 }
56e812ab
PJA
175 else {
176 require Math::BigFloat;
177 $class = 'Math::BigFloat';
126f3c5f 178 }
56e812ab
PJA
179 $class->import(':constant', 'downgrade', $downgrade);
180
181 bignum->accuracy($a) if defined $a;
182 bignum->precision($p) if defined $p;
183 if ($ver) {
184 print "bignum\t\t\t v$VERSION\n";
185 print "Math::BigInt::Lite\t v$Math::BigInt::Lite::VERSION\n" if $_lite;
186 print "Math::BigInt\t\t v$Math::BigInt::VERSION";
187 my $config = Math::BigInt->config();
188 print " lib => $config->{lib} v$config->{lib_version}\n";
189 print "Math::BigFloat\t\t v$Math::BigFloat::VERSION\n";
190 exit;
126f3c5f 191 }
95a2d02c 192
56e812ab
PJA
193 # Take care of octal/hexadecimal constants
194 overload::constant binary =>
195 sub {
196 bigint::_binary_constant(shift);
197 };
95a2d02c 198
56e812ab
PJA
199 # if another big* was already loaded:
200 my ($package) = caller();
4440d13a 201
56e812ab
PJA
202 no strict 'refs';
203 if (!defined *{"${package}::inf"}) {
204 $self->export_to_level(1, $self, @a); # export inf and NaN
4440d13a 205 }
56e812ab 206}
126f3c5f 207
d98d5fa0
T
208sub PI () { Math::BigFloat->new('3.141592653589793238462643383279502884197'); }
209sub e () { Math::BigFloat->new('2.718281828459045235360287471352662497757'); }
210sub bpi ($) { Math::BigFloat::bpi(@_); }
56e812ab
PJA
211sub bexp ($$) {
212 my $x = Math::BigFloat->new($_[0]);
213 $x->bexp($_[1]);
214}
fade31f0 215
126f3c5f
JH
2161;
217
218__END__
219
220=head1 NAME
221
222bignum - Transparent BigNumber support for Perl
223
224=head1 SYNOPSIS
225
226 use bignum;
227
56e812ab
PJA
228 $x = 2 + 4.5,"\n"; # BigFloat 6.5
229 print 2 ** 512 * 0.1,"\n"; # really is what you think it is
230 print inf * inf,"\n"; # prints inf
231 print NaN * 3,"\n"; # prints NaN
126f3c5f 232
4440d13a
T
233 {
234 no bignum;
56e812ab 235 print 2 ** 256,"\n"; # a normal Perl scalar now
4440d13a
T
236 }
237
9663a7f5 238 # for older Perls, import into current package:
d1a15766
T
239 use bignum qw/hex oct/;
240 print hex("0x1234567890123490"),"\n";
241 print oct("01234567890123490"),"\n";
242
126f3c5f
JH
243=head1 DESCRIPTION
244
245All operators (including basic math operations) are overloaded. Integer and
246floating-point constants are created as proper BigInts or BigFloats,
247respectively.
248
56e812ab 249If you do
24716a00
HS
250
251 use bignum;
252
253at the top of your script, Math::BigFloat and Math::BigInt will be loaded
254and any constant number will be converted to an object (Math::BigFloat for
255floats like 3.1415 and Math::BigInt for integers like 1234).
256
257So, the following line:
258
259 $x = 1234;
260
261creates actually a Math::BigInt and stores a reference to in $x.
262This happens transparently and behind your back, so to speak.
263
264You can see this with the following:
265
266 perl -Mbignum -le 'print ref(1234)'
267
268Don't worry if it says Math::BigInt::Lite, bignum and friends will use Lite
269if it is installed since it is faster for some operations. It will be
3c4b39be 270automatically upgraded to BigInt whenever necessary:
24716a00
HS
271
272 perl -Mbignum -le 'print ref(2**255)'
273
274This also means it is a bad idea to check for some specific package, since
275the actual contents of $x might be something unexpected. Due to the
3c4b39be 276transparent way of bignum C<ref()> should not be necessary, anyway.
24716a00
HS
277
278Since Math::BigInt and BigFloat also overload the normal math operations,
279the following line will still work:
280
281 perl -Mbignum -le 'print ref(1234+1234)'
282
283Since numbers are actually objects, you can call all the usual methods from
284BigInt/BigFloat on them. This even works to some extent on expressions:
285
286 perl -Mbignum -le '$x = 1234; print $x->bdec()'
d1a15766
T
287 perl -Mbignum -le 'print 1234->copy()->binc();'
288 perl -Mbignum -le 'print 1234->copy()->binc->badd(6);'
289 perl -Mbignum -le 'print +(1234)->copy()->binc()'
24716a00
HS
290
291(Note that print doesn't do what you expect if the expression starts with
292'(' hence the C<+>)
293
294You can even chain the operations together as usual:
295
d1a15766 296 perl -Mbignum -le 'print 1234->copy()->binc->badd(6);'
24716a00
HS
297 1241
298
299Under bignum (or bigint or bigrat), Perl will "upgrade" the numbers
300appropriately. This means that:
301
302 perl -Mbignum -le 'print 1234+4.5'
303 1238.5
304
305will work correctly. These mixed cases don't do always work when using
306Math::BigInt or Math::BigFloat alone, or at least not in the way normal Perl
56e812ab 307scalars work.
24716a00
HS
308
309If you do want to work with large integers like under C<use integer;>, try
310C<use bigint;>:
311
312 perl -Mbigint -le 'print 1234.5+4.5'
313 1238
314
315There is also C<use bigrat;> which gives you big rationals:
316
317 perl -Mbigrat -le 'print 1234+4.1'
318 12381/10
319
320The entire upgrading/downgrading is still experimental and might not work
d1a15766 321as you expect or may even have bugs. You might get errors like this:
24716a00
HS
322
323 Can't use an undefined value as an ARRAY reference at
324 /usr/local/lib/perl5/5.8.0/Math/BigInt/Calc.pm line 864
325
326This means somewhere a routine got a BigFloat/Lite but expected a BigInt (or
327vice versa) and the upgrade/downgrad path was missing. This is a bug, please
328report it so that we can fix it.
329
330You might consider using just Math::BigInt or Math::BigFloat, since they
331allow you finer control over what get's done in which module/space. For
332instance, simple loop counters will be Math::BigInts under C<use bignum;> and
333this is slower than keeping them as Perl scalars:
334
6e8be9cf 335 perl -Mbignum -le 'for ($i = 0; $i < 10; $i++) { print ref($i); }'
24716a00
HS
336
337Please note the following does not work as expected (prints nothing), since
338overloading of '..' is not yet possible in Perl (as of v5.8.0):
339
6e8be9cf 340 perl -Mbignum -le 'for (1..2) { print ref($_); }'
24716a00 341
b68b7ab1 342=head2 Options
126f3c5f
JH
343
344bignum recognizes some options that can be passed while loading it via use.
345The options can (currently) be either a single letter form, or the long form.
346The following options exist:
347
348=over 2
349
350=item a or accuracy
351
352This sets the accuracy for all math operations. The argument must be greater
353than or equal to zero. See Math::BigInt's bround() function for details.
354
56e812ab 355 perl -Mbignum=a,50 -le 'print sqrt(20)'
126f3c5f 356
c4a6f826 357Note that setting precision and accuracy at the same time is not possible.
95a2d02c 358
126f3c5f
JH
359=item p or precision
360
361This sets the precision for all math operations. The argument can be any
362integer. Negative values mean a fixed number of digits after the dot, while
363a positive value rounds to this digit left from the dot. 0 or 1 mean round to
364integer. See Math::BigInt's bfround() function for details.
365
56e812ab 366 perl -Mbignum=p,-50 -le 'print sqrt(20)'
126f3c5f 367
c4a6f826 368Note that setting precision and accuracy at the same time is not possible.
95a2d02c 369
126f3c5f
JH
370=item t or trace
371
372This enables a trace mode and is primarily for debugging bignum or
373Math::BigInt/Math::BigFloat.
374
375=item l or lib
376
c064d6c6 377Load a different math lib, see L<Math Library>.
126f3c5f 378
56e812ab 379 perl -Mbignum=l,GMP -e 'print 2 ** 512'
126f3c5f
JH
380
381Currently there is no way to specify more than one library on the command
95a2d02c
T
382line. This means the following does not work:
383
56e812ab 384 perl -Mbignum=l,GMP,Pari -e 'print 2 ** 512'
95a2d02c
T
385
386This will be hopefully fixed soon ;)
126f3c5f 387
d1a15766
T
388=item hex
389
43cde5e1 390Override the built-in hex() method with a version that can handle big
9663a7f5
FC
391numbers. This overrides it by exporting it to the current package. Under
392Perl v5.10.0 and higher, this is not so necessary, as hex() is lexically
393overridden in the current scope whenever the bignum pragma is active.
d1a15766
T
394
395=item oct
396
43cde5e1 397Override the built-in oct() method with a version that can handle big
9663a7f5
FC
398numbers. This overrides it by exporting it to the current package. Under
399Perl v5.10.0 and higher, this is not so necessary, as oct() is lexically
400overridden in the current scope whenever the bigint pragma is active.
d1a15766 401
126f3c5f
JH
402=item v or version
403
404This prints out the name and version of all modules used and then exits.
405
56e812ab 406 perl -Mbignum=v
126f3c5f 407
95a2d02c
T
408=back
409
b68b7ab1 410=head2 Methods
b4bc5691
T
411
412Beside import() and AUTOLOAD() there are only a few other methods.
413
24716a00
HS
414Since all numbers are now objects, you can use all functions that are part of
415the BigInt or BigFloat API. It is wise to use only the bxxx() notation, and not
416the fxxx() notation, though. This makes it possible that the underlying object
417might morph into a different class than BigFloat.
418
4440d13a 419=head2 Caveats
990fb837
RGS
420
421But a warning is in order. When using the following to make a copy of a number,
422only a shallow copy will be made.
423
424 $x = 9; $y = $x;
425 $x = $y = 7;
426
b68b7ab1
T
427If you want to make a real copy, use the following:
428
429 $y = $x->copy();
430
990fb837
RGS
431Using the copy or the original with overloaded math is okay, e.g. the
432following work:
433
434 $x = 9; $y = $x;
435 print $x + 1, " ", $y,"\n"; # prints 10 9
436
437but calling any method that modifies the number directly will result in
3c4b39be 438B<both> the original and the copy being destroyed:
990fb837
RGS
439
440 $x = 9; $y = $x;
441 print $x->badd(1), " ", $y,"\n"; # prints 10 10
442
443 $x = 9; $y = $x;
444 print $x->binc(1), " ", $y,"\n"; # prints 10 10
445
446 $x = 9; $y = $x;
447 print $x->bmul(2), " ", $y,"\n"; # prints 18 18
448
d1a15766 449Using methods that do not modify, but test the contents works:
990fb837
RGS
450
451 $x = 9; $y = $x;
452 $z = 9 if $x->is_zero(); # works fine
453
454See the documentation about the copy constructor and C<=> in overload, as
455well as the documentation in BigInt for further details.
456
b4bc5691
T
457=over 2
458
459=item inf()
460
3c4b39be 461A shortcut to return Math::BigInt->binf(). Useful because Perl does not always
b4bc5691
T
462handle bareword C<inf> properly.
463
464=item NaN()
465
3c4b39be 466A shortcut to return Math::BigInt->bnan(). Useful because Perl does not always
b4bc5691
T
467handle bareword C<NaN> properly.
468
d98d5fa0 469=item e
fade31f0 470
56e812ab 471 # perl -Mbignum=e -wle 'print e'
d98d5fa0
T
472
473Returns Euler's number C<e>, aka exp(1).
fade31f0
T
474
475=item PI()
476
56e812ab 477 # perl -Mbignum=PI -wle 'print PI'
d98d5fa0
T
478
479Returns PI.
480
481=item bexp()
482
56e812ab 483 bexp($power,$accuracy);
d98d5fa0
T
484
485Returns Euler's number C<e> raised to the appropriate power, to
486the wanted accuracy.
487
488Example:
489
56e812ab 490 # perl -Mbignum=bexp -wle 'print bexp(1,80)'
d98d5fa0
T
491
492=item bpi()
493
56e812ab 494 bpi($accuracy);
d98d5fa0
T
495
496Returns PI to the wanted accuracy.
497
498Example:
499
56e812ab 500 # perl -Mbignum=bpi -wle 'print bpi(80)'
fade31f0 501
b4bc5691
T
502=item upgrade()
503
504Return the class that numbers are upgraded to, is in fact returning
505C<$Math::BigInt::upgrade>.
506
4440d13a
T
507=item in_effect()
508
56e812ab 509 use bignum;
4440d13a 510
56e812ab
PJA
511 print "in effect\n" if bignum::in_effect; # true
512 {
513 no bignum;
514 print "in effect\n" if bignum::in_effect; # false
515 }
4440d13a
T
516
517Returns true or false if C<bignum> is in effect in the current scope.
518
519This method only works on Perl v5.9.4 or later.
520
b4bc5691
T
521=back
522
bd49aa09 523=head2 Math Library
126f3c5f
JH
524
525Math with the numbers is done (by default) by a module called
526Math::BigInt::Calc. This is equivalent to saying:
527
56e812ab 528 use bignum lib => 'Calc';
126f3c5f
JH
529
530You can change this by using:
531
56e812ab 532 use bignum lib => 'GMP';
126f3c5f
JH
533
534The following would first try to find Math::BigInt::Foo, then
535Math::BigInt::Bar, and when this also fails, revert to Math::BigInt::Calc:
536
56e812ab 537 use bignum lib => 'Foo,Math::BigInt::Bar';
126f3c5f
JH
538
539Please see respective module documentation for further details.
540
bd49aa09
SP
541Using C<lib> warns if none of the specified libraries can be found and
542L<Math::BigInt> did fall back to one of the default libraries.
c4a6f826 543To suppress this warning, use C<try> instead:
bd49aa09 544
56e812ab 545 use bignum try => 'GMP';
bd49aa09
SP
546
547If you want the code to die instead of falling back, use C<only> instead:
548
56e812ab 549 use bignum only => 'GMP';
bd49aa09 550
126f3c5f
JH
551=head2 INTERNAL FORMAT
552
553The numbers are stored as objects, and their internals might change at anytime,
554especially between math operations. The objects also might belong to different
f4a32604 555classes, like Math::BigInt, or Math::BigFloat. Mixing them together, even
126f3c5f
JH
556with normal scalars is not extraordinary, but normal and expected.
557
558You should not depend on the internal format, all accesses must go through
559accessor methods. E.g. looking at $x->{sign} is not a bright idea since there
560is no guaranty that the object in question has such a hashkey, nor is a hash
561underneath at all.
562
563=head2 SIGN
564
c4a6f826 565The sign is either '+', '-', 'NaN', '+inf' or '-inf' and stored separately.
126f3c5f
JH
566You can access it with the sign() method.
567
568A sign of 'NaN' is used to represent the result when input arguments are not
569numbers or as a result of 0/0. '+inf' and '-inf' represent plus respectively
570minus infinity. You will get '+inf' when dividing a positive number by 0, and
571'-inf' when dividing any negative number by 0.
572
7ed767c4 573=head1 CAVEATS
d1a15766
T
574
575=over 2
576
fa7b7678
TC
577=item Operator vs literal overloading
578
579C<bignum> works by overloading handling of integer and floating point
580literals, converting them to L<Math::BigInt> or L<Math::BigFloat>
581objects.
582
583This means that arithmetic involving only string values or string
584literals will be performed using Perl's built-in operators.
585
586For example:
587
588 use bignum;
589 my $x = "900000000000000009";
590 my $y = "900000000000000007";
591 print $x - $y;
592
593will output C<0> on default 32-bit builds, since C<bigrat> never sees
594the string literals. To ensure the expression is all treated as
595C<Math::BigInt> or C<BigFloat> objects, use a literal number in the
596expression:
597
598 print +(0+$x) - $y;
599
d1a15766
T
600=item in_effect()
601
602This method only works on Perl v5.9.4 or later.
603
604=item hex()/oct()
605
606C<bigint> overrides these routines with versions that can also handle
607big integer values. Under Perl prior to version v5.9.4, however, this
608will not happen unless you specifically ask for it with the two
609import tags "hex" and "oct" - and then it will be global and cannot be
610disabled inside a scope with "no bigint":
611
56e812ab 612 use bigint qw/hex oct/;
d1a15766 613
56e812ab
PJA
614 print hex("0x1234567890123456");
615 {
616 no bigint;
617 print hex("0x1234567890123456");
618 }
d1a15766
T
619
620The second call to hex() will warn about a non-portable constant.
621
622Compare this to:
623
56e812ab 624 use bigint;
d1a15766 625
56e812ab
PJA
626 # will warn only under older than v5.9.4
627 print hex("0x1234567890123456");
d1a15766
T
628
629=back
630
126f3c5f
JH
631=head1 MODULES USED
632
633C<bignum> is just a thin wrapper around various modules of the Math::BigInt
634family. Think of it as the head of the family, who runs the shop, and orders
635the others to do the work.
636
637The following modules are currently used by bignum:
638
56e812ab
PJA
639 Math::BigInt::Lite (for speed, and only if it is loadable)
640 Math::BigInt
641 Math::BigFloat
126f3c5f
JH
642
643=head1 EXAMPLES
644
645Some cool command line examples to impress the Python crowd ;)
f703fc96 646
56e812ab
PJA
647 perl -Mbignum -le 'print sqrt(33)'
648 perl -Mbignum -le 'print 2*255'
649 perl -Mbignum -le 'print 4.5+2*255'
650 perl -Mbignum -le 'print 3/7 + 5/7 + 8/3'
651 perl -Mbignum -le 'print 123->is_odd()'
652 perl -Mbignum -le 'print log(2)'
653 perl -Mbignum -le 'print exp(1)'
654 perl -Mbignum -le 'print 2 ** 0.5'
655 perl -Mbignum=a,65 -le 'print 2 ** 0.2'
656 perl -Mbignum=a,65,l,GMP -le 'print 7 ** 7777'
126f3c5f
JH
657
658=head1 LICENSE
659
660This program is free software; you may redistribute it and/or modify it under
661the same terms as Perl itself.
662
663=head1 SEE ALSO
664
665Especially L<bigrat> as in C<perl -Mbigrat -le 'print 1/3+1/4'>.
666
667L<Math::BigFloat>, L<Math::BigInt>, L<Math::BigRat> and L<Math::Big> as well
be83fca7 668as L<Math::BigInt::Pari> and L<Math::BigInt::GMP>.
126f3c5f
JH
669
670=head1 AUTHORS
671
95a2d02c 672(C) by Tels L<http://bloodgate.com/> in early 2002 - 2007.
126f3c5f
JH
673
674=cut