summaryrefslogtreecommitdiff
path: root/ext/Math-BigRat
diff options
context:
space:
mode:
authorChris Williams <chris@bingosnet.co.uk>2009-09-10 23:12:28 +0100
committerChris Williams <chris@bingosnet.co.uk>2009-09-10 23:12:28 +0100
commitc6c613ed7cf301ecf7d4b5dcbf9642fa0fb63333 (patch)
treef922ee727ef00bc1056821c5d9482ce1380b7376 /ext/Math-BigRat
parente31176d44a6dc4092a991b69ba82d40052a59d4d (diff)
downloadperl-c6c613ed7cf301ecf7d4b5dcbf9642fa0fb63333.tar.gz
Updated Math::BigRat to CPAN version 0.24
Diffstat (limited to 'ext/Math-BigRat')
-rw-r--r--ext/Math-BigRat/lib/Math/BigRat.pm11
-rw-r--r--ext/Math-BigRat/t/bigrat.t4
2 files changed, 10 insertions, 5 deletions
diff --git a/ext/Math-BigRat/lib/Math/BigRat.pm b/ext/Math-BigRat/lib/Math/BigRat.pm
index 6d77f98923..2460d1c7d4 100644
--- a/ext/Math-BigRat/lib/Math/BigRat.pm
+++ b/ext/Math-BigRat/lib/Math/BigRat.pm
@@ -23,7 +23,8 @@ use vars qw($VERSION @ISA $upgrade $downgrade
@ISA = qw(Math::BigFloat);
-$VERSION = '0.22';
+$VERSION = '0.24';
+$VERSION = eval $VERSION;
use overload; # inherit overload from Math::BigFloat
@@ -279,7 +280,7 @@ sub new
}
# simple string input
- if (($n =~ /[\.eE]/))
+ if (($n =~ /[\.eE]/) && $n !~ /^0x/)
{
# looks like a float, quacks like a float, so probably is a float
$self->{sign} = 'NaN';
@@ -1686,7 +1687,7 @@ use L<as_int()> or L<as_float()> instead.
This routine is automatically used whenever a scalar is required:
my $x = Math::BigRat->new('3/1');
- @array = (1,2,3);
+ @array = (0,1,2,3);
$y = $array[$x]; # set $y to 3
=head2 as_int()/as_number()
@@ -2012,6 +2013,8 @@ may contain more documentation and examples as well as testcases.
=head1 AUTHORS
-(C) by Tels L<http://bloodgate.com/> 2001 - 2008.
+(C) by Tels L<http://bloodgate.com/> 2001 - 2009.
+
+Currently maintained by Jonathan "Duke" Leto <jonathan@leto.net> L<http://leto.net>
=cut
diff --git a/ext/Math-BigRat/t/bigrat.t b/ext/Math-BigRat/t/bigrat.t
index d898335961..c7563e5f70 100644
--- a/ext/Math-BigRat/t/bigrat.t
+++ b/ext/Math-BigRat/t/bigrat.t
@@ -8,7 +8,7 @@ BEGIN
$| = 1;
chdir 't' if -d 't';
unshift @INC, '../lib'; # for running manually
- plan tests => 198;
+ plan tests => 200;
}
# basic testing of Math::BigRat
@@ -53,6 +53,8 @@ foreach my $func (qw/new bnorm/)
$x = $cr->$func('-inf'); ok ($x,'-inf');
$x = $cr->$func('1/'); ok ($x,'NaN');
+ $x = $cr->$func("0x7e"); ok($x, 126);
+
# input ala '1+1/3' isn't parsed ok yet
$x = $cr->$func('1+1/3'); ok ($x,'NaN');