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

"FastMath" contains fractions of constants

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • None
    • 3.0
    • None
    • None

    Description

      Fractions such as 1.0 / 3.0, 1.0 / 5.0, ... could be replaced with static final constants.
      In "asinh", for example, the change can sometimes result in more than halving the computation time (when the argument is in the range of values where the constants are used).

      In absolute times, the gain is not huge, amounting (on my machine) to something like 370 ms for 10 million computations.

      And, of course, the downside will be that these constants will be computed at the loading of "FastMath", leading to an additional penalty of about 16 divisions at initialization...

      Attachments

        Activity

          People

            erans Gilles Sadowski
            erans Gilles Sadowski
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: