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

FastMath.[cosh, sinh] do not support the same range of values as the Math counterparts

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.1
    • Labels:
      None

      Description

      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;

        Attachments

        1. MATH-905.diff
          5 kB
          Gilles Sadowski

        Issue Links

          Activity

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

            People

            • Assignee:
              Unassigned
              Reporter:
              tn Thomas Neidhart

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment