[
https://issues.apache.org/jira/browse/MATH-1269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14737796#comment-14737796
]
Sebb commented on MATH-1269:
----------------------------
It looks like the problem is that the function works fine up to the maximum
that can be represented in a double.
It agrees with j.l.Math up to 709.782712893384 (0x1.62e42fefa39efp9) and for
many numbers after that point it shows Infinity also in agreement with j.l.Math.
However eventually it starts returning NaN instead of Infinity, whereas
j.l.Math continues to return Infinity.
I think there are a couple of options here:
1) choose a number between 709 and 710 which is correctly calculated in the
Infinite range and use that as the max
2) convert NaN to Infinity as appropriate.
In either case it would be a good idea to add a test to show that Math and
FastMath agree for doubles which are around the max value that can be
calculated. Ditto for expm1().
> FastMath.exp may return NaN for non-NaN arguments
> -------------------------------------------------
>
> Key: MATH-1269
> URL: https://issues.apache.org/jira/browse/MATH-1269
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 4.0
> Reporter: Otmar Ertl
> Attachments: MATH-1269.patch
>
>
> I have observed that FastMath.exp(709.8125) returns NaN. However, the
> exponential function must never return NaN (if the argument is not NaN). The
> result must always be non-negative or positive infinity.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)