Algorithm::AM::BigInt - Helper functions for AM big integers
use Algorithm::AM::BigInt 'bigcmp'; # get some big integers from Algorithm::AM::Result my ($a, $b); bigcmp($a, $b);
AM uses custom 128-bit unsigned integers in its XS code, and these numbers cannot be treated normally in Perl code. This package provides some helper functions for working with these numbers.
Under the hood, the big integers used by AM are scalars with the following fields:
This is an inexact double representation of the integer value.
This is an exact string representation of the integer value.
Operations on the floating-point representation will necessarily have a small amount of error, so exact calculation or comparison requires referencing the string field. The number field is still useful in printing reports; for example, using
printf, where precision can be specified.
Currently, the only provided helper function is for comparison of two big integers.
Compares two big integers, returning 1, 0, or -1 depending on whether the first argument is greater than, equal to, or less than the second argument.
Theron Sanford <firstname.lastname@example.org>, Nathan Glenn <email@example.com>
This software is copyright (c) 2013 by Royal Skousen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.