Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-722

[math] Complex Tanh for "big" numbers

Rank to TopRank to BottomVotersWatch issueWatchersConvert to sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 3.0
    • Labels:
    • Environment:

      I'm working with Eclipse 3.6.2 on Windows XP, but the bug is Enviroment independent

      Description

      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

        Attachments

          Activity

          $i18n.getText('security.level.explanation', $currentSelection) Viewable by All Users
          Cancel

            People

            • Assignee:
              celestin Sebastien Brisard
              Reporter:
              jbbpopo Juan Barandiaran

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0.25h
                0.25h
                Remaining:
                Remaining Estimate - 0.25h
                0.25h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Issue deployment