commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thundre (Updated) (JIRA)" <>
Subject [jira] [Updated] (MATH-744) BigFraction.doubleValue() returns Double.NaN for large numerators or denominators
Date Sun, 12 Feb 2012 21:14:59 GMT


Thundre updated MATH-744:

    Comment: was deleted

(was: I don't have the test classes working in Eclipse, so I can't do it there.  Here's a
main method that demonstrates.  (10^401+1)/(10^400) is just a smidgen more than 10. 

    public static void main(String args[]) {
        double x = new BigFraction(BigInteger.TEN.pow(401).add(BigInteger.ONE),
> BigFraction.doubleValue() returns Double.NaN for large numerators or denominators
> ---------------------------------------------------------------------------------
>                 Key: MATH-744
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.2
>            Reporter: Thundre
>         Attachments: site.patch, test.patch
> The current implementation of doubleValue() divides numerator.doubleValue() / denominator.doubleValue().
 BigInteger.doubleValue() fails for any number greater than Double.MAX_VALUE.  So if the user
has 308-digit numerator or denominator, the resulting quotient fails, even in cases where
the result would be well inside Double's range.
> I have a patch to fix it, if I can figure out how to attach it here I will.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message