|
From: Julian S. <js...@ac...> - 2010-06-12 19:48:45
|
On Monday, June 07, 2010, Tom Hughes wrote:
> On 07/06/10 07:15, Julian Seward wrote:
> >> Probably best just to use Math::BigInt then you can do arbitrary
> >> precision integer arithmetic regardless of the underlying platform.
> >
> > Is Math::BigInt is supported as standard in Perl? and also, in older
> > Perls? Obviously if the build process is going to rely on it then
> > it needs to be available on all perls we could reasonably expect to
> > encounter.
>
> Since at least 5.005 yes, and if you've got a system with anything older
> than that then you already have serious pain as that was released in
> July 1998.
Hmm, doesn't work with the stock perl on redhat9 (prehistoric, I know,
but certainly post-dates perl 5.005). Am I doing something wrong?
J
$ uname -a
Linux redhat9 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386
GNU/Linux
$ perl --version
This is perl, v5.8.0 built for i386-linux-thread-multi
(with 1 registered patch, see perl -V for more detail)
$ cat ascript.pl
#! /usr/bin/perl
use Math::BigInt;
use strict;
my $x = hex( @ARGV[0] );
printf("result = %x %x\n", $x, $x - 0x800000);
$ ./ascript.pl 0x138000000
Integer overflow in hexadecimal number at ./ascript.pl line 6.
result = ffffffff ffffffff
|