Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8240632

Note differences between IEEE 754-2019 math lib special cases and java.lang.Math

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 15
    • Fix Version/s: 17
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b09

      Description

      For various math library functions, there are multiple plausible behaviors in some special cases. Starting with IEEE 754-2008 and continuing with IEEE 754-2019, the standard makes recommendations for handling those special values. In some of the special cases, the IEEE recommendations do not match the pre-existing behavior defined for java.lang.Math and java.lang.StrictMath. The java.lang.{Math, StrictMath} classes both long predate the floating-point standard to provide recommendations for the math library.

      These differences, and other notable ties to IEEE 754-2019 should be noted in the specification of java.lang.Math.

      The differences include:

      * cos(0.0) = 1.0
      * exp(0.0) = 1.0
      * acos(1.0) = 0.0
      * acos((+/- infinity) = pi/2
      * log(1.0) => 0.0
      * log10(1.0) => 0.0
      * hypot(+/-0, +/-0) => +0.0

      The Math/StrictMath implementations are expected to conform to most of these behaviors, but the current specification doesn't explicitly require them too.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              darcy Joe Darcy
              Reporter:
              darcy Joe Darcy
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: