diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-12-17 05:37:51 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-12-17 05:37:51 +0000 |
commit | 5dce09b1b12bc4dff9713d5dbb5291ac967ccf63 (patch) | |
tree | ce52febbd5d04808b72ecb67ccb2e5b601a8a587 /lib/Math/BigFloat.pm | |
parent | abd75f244b222c1ed3bdddd03baac15292b665b4 (diff) | |
download | perl-5dce09b1b12bc4dff9713d5dbb5291ac967ccf63.tar.gz |
fix bug when one of the operands is +0E+0 (from Ronald J Kimball
<rjk@linguist.dartmouth.edu>)
p4raw-id: //depot/perl@4685
Diffstat (limited to 'lib/Math/BigFloat.pm')
-rw-r--r-- | lib/Math/BigFloat.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Math/BigFloat.pm b/lib/Math/BigFloat.pm index 8aa6a6604b..1a9195e185 100644 --- a/lib/Math/BigFloat.pm +++ b/lib/Math/BigFloat.pm @@ -240,12 +240,13 @@ sub fcmp #(fnum_str, fnum_str) return cond_code if ($x eq "NaN" || $y eq "NaN") { undef; } else { + local($xm,$xe,$ym,$ye) = split('E', $x."E$y"); + if ($xm eq '+0' || $ym eq '+0') { + return $xm <=> $ym; + } ord($y) <=> ord($x) - || - ( local($xm,$xe,$ym,$ye) = split('E', $x."E$y"), - (($xe <=> $ye) * (substr($x,$[,1).'1') - || Math::BigInt::cmp($xm,$ym)) - ); + || ($xe <=> $ye) * (substr($x,$[,1).'1') + || Math::BigInt::cmp($xm,$ym); } } |