Array equality, comparison and mismatch (original) (raw)

Mike Duigou openjdk at duigou.org
Tue Oct 13 03:46:18 UTC 2015


- I apologize if this was discussed earlier in the thread but why is the comparison of floats and doubles done by first == operator of the int bits and only then the compare method ? I was being consistent with the test used for the existing equals methods of float[] and double[]. Note that the Float/Double.toBits methods are intrinsic.

I guess my worry is that the == floatToIntBits would be redundant as the implementation of compare() might have exactly the same test as it's first step--it would be a reasonable optimization since it would have the benefit of loading the values into registers before doing the more expensive relational comparison.

Mike



More information about the core-libs-dev mailing list