Commit 79b311c1 authored by Max Cai's avatar Max Cai
Browse files

Correctness: floating point equality using bits instead of ==.

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
parent 1b1735ce
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment