• Max Cai's avatar
    Correctness: floating point equality using bits instead of ==. · 79b311c1
    Max Cai authored
    Special values for float and double make it inaccurate to test the equality with ==.
    The main Java library uses the standard Object.equals() implementation for all fields,
    which for floating point fields means Float.equals() or Double.equals(). They define
    equality as bitwise equality, with all NaN representations normalized to the same bit
    sequence (and therefore equal to each other). This test checks that the nano
    implementation complies with Object.equals(), so NaN == NaN and +0.0 != -0.0.
    
    Change-Id: I97bb4a3687223d8a212c70cd736436b9dd80c1d7
    79b311c1
Name
Last commit
Last update
java Loading commit data...
src/google/protobuf Loading commit data...
Android.mk Loading commit data...