commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Brisard (Resolved) (JIRA) <j...@apache.org>
Subject [jira] [Resolved] (MATH-722) [math] Complex Tanh for "big" numbers
Date Fri, 27 Jan 2012 07:03:38 GMT

     [ https://issues.apache.org/jira/browse/MATH-722?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sébastien Brisard resolved MATH-722.
------------------------------------

    Resolution: Fixed

Changes proposed by Juan committed in {{r1236548}}.
                
> [math] Complex Tanh for "big" numbers
> -------------------------------------
>
>                 Key: MATH-722
>                 URL: https://issues.apache.org/jira/browse/MATH-722
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.2
>         Environment: I'm working with Eclipse 3.6.2 on Windows XP, but the bug is Enviroment
independent
>            Reporter: Juan Barandiaran
>            Assignee: Sébastien Brisard
>            Priority: Minor
>              Labels: patch
>             Fix For: 3.0
>
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> Hi,
> In Complex.java the tanh is computed with the following formula:
> tanh(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i
> The problem that I'm finding is that as soon as "a" is a "big" number,
> both sinh(2a) and cosh(2a) are infinity and then the method tanh returns in
> the real part NaN (infinity/infinity) when it should return 1.0.
> Wouldn't it be appropiate to add something as in the FastMath library??:
> if (real>20.0){
>       return createComplex(1.0, 0.0);
> }
> if (real<-20.0){
>       return createComplex(-1.0, 0.0);
> }
> Best regards,
> JBB

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message