Yossi Saiada
03/06/2019, 3:09 PM(0.0).equals(-0.0) // false
(0.0) == (-0.0) // true
Does anyone can explain it?Pavlo Liapota
03/06/2019, 3:13 PMghedeon
03/06/2019, 3:15 PMghedeon
03/06/2019, 3:16 PMcommanderpepper
03/06/2019, 3:16 PMPavlo Liapota
03/06/2019, 3:17 PMilya.gorbunov
03/06/2019, 3:17 PMYossi Saiada
03/06/2019, 3:18 PM(0.0) == (-0.0) return true?ilya.gorbunov
03/06/2019, 3:20 PM== uses IEEE-754 order, which considers them equal.
The function equals uses total order, so these values are distinct.Shawn
03/06/2019, 3:21 PM== not actually always translate to a .equals() call?ilya.gorbunov
03/06/2019, 3:21 PMghedeon
03/06/2019, 3:22 PMequals behaves differently to support generic use cases and provide total ordering. So, it's good for sorting and stuff.