develooper Front page | perl.perl5.porters | Postings from December 2010

[perl #81172] [PATCH] Fix RT 62764: Math::BigFloat->bcmp() fails.

From:
Father Chrysostomos via RT
Date:
December 26, 2010 14:39
Subject:
[perl #81172] [PATCH] Fix RT 62764: Math::BigFloat->bcmp() fails.
Message ID:
rt-3.6.HEAD-5425-1293403161-1077.81172-15-0@perl.org
On Wed Dec 22 10:48:47 2010, pjacklam@online.no wrote:
> Why: The Math::BigFloat->bcmp() method returns the wrong result when
> the
> exponent is too large to be represented exactly as a Perl numerical
> scalar. In such cases, bcmp() returns 0 because it fails to
> distinguish
> between the two exponents.
> 
> How: With this fix, bcmp() does not convert the exponents to Perl
> numerical scalars, but keeps them as arbitrary precision integers,
> thus
> returning the correct result regardsless of the number of digits in
> the
> exponent.
> 
> Test: Two tests added. These tests fail with the old code.
> 
> Files:
> 
> - lib/Math/BigFloat.pm: New version of bcmp().
> 
> - t/bigfltpm.inc: Add two tests confirming desired behaviour.
> 
> - t/bare_mbf.t: Increment test count.
> 
> - t/bigfltpm.t: Increment test count.
> 
> - t/sub_mbf.t: Increment test count.
> 
> - t/with_sub.t Increment test count.
> ---
>  dist/Math-BigInt/lib/Math/BigFloat.pm |  189
> ++++++++++++++++++++++++---------
>  dist/Math-BigInt/t/bare_mbf.t         |    2 +-
>  dist/Math-BigInt/t/bigfltpm.inc       |    2 +
>  dist/Math-BigInt/t/bigfltpm.t         |    2 +-
>  dist/Math-BigInt/t/sub_mbf.t          |    2 +-
>  dist/Math-BigInt/t/with_sub.t         |    2 +-
>  6 files changed, 147 insertions(+), 52 deletions(-)
> 

Thank you. Applied as aa45dafa.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About