Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The following classes have inconsistent behavior between equals and hashCode in regard to +0.0 and -0.0:
- EpsilonDoublePrecisionContext
- Vector1D
- Vector2D
- Vector2D
- SphericalCoordinates
- PolarCoordinates
- AffineTransformMatrix2D
- AffineTransformMatrix3D
- AxisAngleSequence
This inconsistency comes from the use of == or Precision.equals to compare doubles in the equals method (which consider +0.0 and -0.0 to be equal) and Double.hashCode in the hashCode method (which returns different hash codes for +0.0 and -0.0). Hence, instances could be considered equal but have different hash codes.
We should standardize on the use of Double.compare in equals and Double.hashCode in hashCode.
Attachments
Issue Links
- links to