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

Clarify definition of 1-ulp accuracy

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 5.0
    • 5.0
    • core-libs
    • tiger
    • generic
    • generic

      When explaining the accuracy of floating-point methods, the current java.lang.Math JavaDoc states:

      "Informally, with a 1 ulp error bound, when the exact result is a representable number the exact result should be returned; otherwise, either of the two floating-point numbers closest to the exact result may be returned."

      This statement is slightly incorrect; instead of the two closest floating-point values it would be more correct to say one of the bracketing floating-point values. The difference between the two definitions occurs when the exact result is slightly greater than a power of two. In that case, the two closest results would be the power of two and the floating-point number next smaller in magnitude than the power of two. The two braketing numbers would be the power of two and the floating-point number next larger in magnitude. This latter definition is the correct (and intended) one.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: