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

Math. negativeZeroFloatBits and Math. negativeZeroDoubleBits should be final

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • None
    • core-libs
    • None
    • b07

      there’s two fields in java.lang.Math that are not final, but they really should be:

          // Use raw bit-wise conversions on guaranteed non-NaN arguments.
          private static long negativeZeroFloatBits = Float.floatToRawIntBits(-0.0f);
          private static long negativeZeroDoubleBits = Double.doubleToRawLongBits(-0.0d);

      since they’re used in Math.min/max, these non-final fields do have performance implications.

            darcy Joe Darcy
            lstadler Lukas Stadler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: