Why Kotlin considers negative zero less than positive zero

I was just starting to learn Kotlin, and I came across a strange suggestion in the documentation of the main types :

-0.0 is considered less than 0.0

I understand that their values ​​will not be the same in the supplement, but I do not know how this can be used in the code.

+4
source share
1 answer

, IEEE 754, , , , , . , -0.0 0.0 ( ).

, , NaN , , NaN!= NaN.

, , NaN , , ( ).

, , , . , ( Any ), , , IEEE 754.

+5

Source: https://habr.com/ru/post/1693159/


All Articles