Pm1r8FZZhjw7hyZlGgwS/sSOCctsC9SRLZ/uEZ
4iYwaZWJAuQ8t001lYrioWldpKkNdioLYIkzPjrWlLICoNaOgqd6nXe2PALjRXOoUS6XoB3Vfhjg
ZIuOr7VVupFEEtWjcxSYQup5XJEWxbl958guwLy9LdF4PPChTDQxoEPGHGMNsizuX8gCr2A2JfjN
6OvMpoh1Fj1BkgtIvPf3z6manAnNJBF+j/3cKZxMnYz7Qvpn9aaJPsNisHQx1sDfgAQeQ+LKgT9I
Yj69rjnR+qdn+K69T12XPGyFME8BvZb1ohC5f14hb7V1EEMJNhuF7GHyn3Hi5UsPdoBBbQqGpDp4
+iaj31HYTKKIgJrvIVwyjbFzwQKHeNyUvGgTng94btapiwpcEBbeJE2w0QSpiSrWueAFsn23H+de
m9Az32IC9Op579XGKpFNqxlHIA5liCfuSn+AWrHiNZIcIvhPPm5PS4RY9g9Hiwn1oIuIITy+e2ib
eWlIyifrveK2oYSW2CKyrdWP0Tr3yIQuJO78gLZgqAOB9W3YHuzAsXE2KVcr+Sou6BKeFkLhL2xa
IOvw6Sg3oWfwAQR+2cFJsmWhI5lAnJugtUsXvSPUDTktXG3WoXsvTepAxoBjBksYAGJz5W407DRb
SQBNYlgue2Hw4r43EUJIOIZa575a2xk2mXPQaAJr3su0xz0WYRWC1ndiFaJ53nl3HWI7EFeVa1yS
pVLAhEUt3CKjfJIOQEO8gxmoYf2tq6tt8tGUDyHGO35iDz8nO72Rxohkk4eToZdfQ2Ks2TqjkQkr
PxP+2NxVDoUa9oZgFBKtmzmibMBjVPKHnuxr+p0t/syLrUZqj93Rl0ytVEEJO6WGKh8xz952Bf6b
hcgN1eOd/F/R8L0N1bq40QKS9xORc4DrJW+7Wub4FwphHx1JxErDMiKkRwWzh0DY84tRBLRb/Cq8
uXYDgD+FmN+7Ri9rjiYxFrLbQe1gbJCIhi7c78BjcbdKza4ZeZ1RLDaW+h/dHut normal and expected.

You should not depend on the internal format, all accesses must go through
accessor methods. E.g. looking at $x->{sign} is not a good idea since there
is no guaranty that the object in question has such a hash key, nor is a hash
underneath at all.

=head2 Sign

The sign is either '+', '-', 'NaN', '+inf' or '-inf'.
You can access it with the sign() method.

A sign of 'NaN' is used to represent the result when input arguments are not
numbers or as a result of 0/0. '+inf' and '-inf' represent plus respectively
minus infinity. You will get '+inf' when dividing a positive number by 0, and
'-inf' when dividing any negative number by 0.

=head2 Method calls

Since all numbers are now objects, you can use all functions that are part of
the BigInt API. You can only use the bxxx() notation, and not the fxxx()
notation, though.

But a warning is in order. When using the following to make a copy of a number,
only a shallow copy will be made.

        $x = 9; $y = $x;
        $x = $y = 7;

Using the copy or the original with overloaded math is okay, e.g. the
following work:

        $x = 9; $y = $x;
        print $x + 1, " ", $y,"\n";     # prints 10 9

but calling any method that modifies the number directly will result in
B<both> the original and the copy being destroyed:

        $x = 9; $y = $x;
        print $x->badd(1), " ", $y,"\n";        # prints 10 10

        $x = 9; $y = $x;
        print $x->binc(1), " ", $y,"\n";        # prints 10 10

        $x = 9; $y = $x;
        print $x->bmul(2), " ", $y,"\n";        # prints 18 18

Using methods that do not modify, but test that the contents works:

        $x = 9; $y = $x;
        $z = 9 if $x->is_zero();                # works fine

See the documentation about the copy constructor and C<=> in overload, as
well as the documentation in BigInt for further details.

=head2 Methods

=over 2

=item inf()

A shortcut to return Math::BigInt->binf(). Useful because Perl does not always
handle bareword C<inf> properly.

=item NaN()

A shortcut to return Math::BigInt->bnan(). Useful because Perl does not always
handle bareword C<NaN> properly.

=item e

        # perl -Mbigint=e -wle 'print e'

Returns Euler's number C<e>, aka exp(1). Note that under bigint, this is
truncated to an integer, and hence simple '2'.

=item PI

        # perl -Mbigint=PI -wle 'print PI'

Returns PI. Note that under bigint, this is truncated to an integer, and hence
simple '3'.

=item bexp()

        bexp($power,$accuracy);

Returns Euler's number C<e> raised to the appropriate power, to
the wanted accuracy.

Note that under bigint, the result is truncated to an integer.

Example:

        # perl -Mbigint=bexp -wle 'print bexp(1,80)'

=item bpi()

        bpi($accuracy);

Returns PI to the wanted accuracy. Note that under bigint, this is truncated
to an integer, and hence simple '3'.

Example:

        # perl -Mbigint=bpi -wle 'print bpi(80)'

=item upgrade()

Return the class that numbers are upgraded to, is in fact returning
C<$Math::BigInt::upgrade>.

=item in_effect()

        use bigint;

        print "in effect\n" if bigint::in_effect;       # true
        {
          no bigint;
          print "in effect\n" if bigint::in_effect;     # false
        }

Returns true or false if C<bigint> is in effect in the current scope.

This method only works on Perl v5.9.4 or later.

=back

=head1 CAVEATS

=over 2

=item Operator vs literal overloading

C<bigint> works by overloading handling of integer and floating point
literals, converting them to L<Math::BigInt> objects.

This means that arithmetic involving only string values or string
literals will be performed using Perl's built-in operators.

For example:

    use bignum;
    my $x = "900000000000000009";
    my $y = "900000000000000007";
    print $x - $y;

will output C<0> on default 32-bit builds, since C<bigint> never sees
the string literals.  To ensure the expression is all treated as
C<Math::BigInt> objects, use a literal number in the expression:

    print +(0+$x) - $y;

=item ranges

Perl does not allow overloading of ranges, so you can neither safely use
ranges with bigint endpoints, nor is the iterator variable a bigint.

        use 5.010;
        for my $i (12..13) {
          for my $j (20..21) {
            say $i ** $j;  # produces a floating-point number,
                           # not a big integer
          }
        }

=item in_effect()

This method only works on Perl v5.9.4 or later.

=item hex()/oct()

C<bigint> overrides these routines with versions that can also handle
big integer values. Under Perl prior to version v5.9.4, however, this
will not happen unless you specifically ask for it with the two
import tags "hex" and "oct" - and then it will be global and cannot be
disabled inside a scope with "no bigint":

        use bigint qw/hex oct/;

        print hex("0x1234567890123456");
        {
                no bigint;
                print hex("0x1234567890123456");
        }

The second call to hex() will warn about a non-portable constant.

Compare this to:

        use bigint;

        # will warn only under Perl older than v5.9.4
        print hex("0x1234567890123456");

=back

=head1 MODULES USED

C<bigint> is just a thin wrapper around various modules of the Math::BigInt
family. Think of it as the head of the family, who runs the shop, and orders
the others to do the work.

The following modules are currently used by bigint:

        Math::BigInt::Lite      (for speed, and only if it is loadable)
        Math::BigInt

=head1 EXAMPLES

Some cool command line examples to impress the Python crowd ;) You might want
to compare them to the results under -Mbignum or -Mbigrat:

        perl -Mbigint -le 'print sqrt(33)'
        perl -Mbigint -le 'print 2*255'
        perl -Mbigint -le 'print 4.5+2*255'
        perl -Mbigint -le 'print 3/7 + 5/7 + 8/3'
        perl -Mbigint -le 'print 123->is_odd()'
        perl -Mbigint -le 'print log(2)'
        perl -Mbigint -le 'print 2 ** 0.5'
        perl -Mbigint=a,65 -le 'print 2 ** 0.2'
        perl -Mbignum=a,65,l,GMP -le 'print 7 ** 7777'

=head1 BUGS

For information about bugs and how to report them, see the BUGS section in the
documentation available with the perldoc command.

    perldoc bignum

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc bigint

For more information, see the SUPPORT section in the documentation available
with the perldoc command.

    perldoc bignum

=head1 LICENSE

This program is free software; you may redistribute it and/or modify it under
the same terms as Perl itself.

=head1 SEE ALSO

L<bignum> and L<bigrat>.

L<Math::BigInt>, L<Math::BigFloat>, L<Math::BigRat> and L<Math::Big> as well as
L<Math::BigInt::FastCalc>, L<Math::BigInt::Pari> and L<Math::BigInt::GMP>.

=head1 AUTHORS

=over 4

=item *

(C) by Tels L<http://bloodgate.com/> in early 2002 - 2007.

=item *

Maintained by Peter John Acklam E<lt>pjacklam@gmail.com<gt>, 2014-.

=back

=cut
