commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Created] (MATH-905) FastMath.[cosh, sinh] do not support the same range of values as the Math counterparts
Date Tue, 20 Nov 2012 20:54:58 GMT
Thomas Neidhart created MATH-905:
------------------------------------

             Summary: FastMath.[cosh, sinh] do not support the same range of values as the
Math counterparts
                 Key: MATH-905
                 URL: https://issues.apache.org/jira/browse/MATH-905
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 3.0
            Reporter: Thomas Neidhart
             Fix For: 3.1


As reported by Jeff Hain:

cosh(double) and sinh(double):
Math.cosh(709.783) = 8.991046692770538E307
FastMath.cosh(709.783) = Infinity
Math.sinh(709.783) = 8.991046692770538E307
FastMath.sinh(709.783) = Infinity
===> This is due to using exp( x )/2 for values of |x|
above 20: the result sometimes should not overflow,
but exp( x ) does, so we end up with some infinity.
===> for values of |x| >= StrictMath.log(Double.MAX_VALUE),
exp will overflow, so you need to use that instead:
for x positive:
double t = exp(x*0.5);
return (0.5*t)*t;
for x negative:
double t = exp(-x*0.5);
return (-0.5*t)*t;

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message