Wednesday, 3 February 2016

Julia: Comparison operators Vs Special float values

a.   Positive zero is equal to negative zero, but not greater, less than negative zero.
b.   Inf is equal to itself and greater than everything, except NaN
c.    -Inf is equal to itself and less then everything, except NaN.

d.   NaN is not equal to, not less than, and not greater than anything, including itself.

julia> 0.0==-0.0
true

julia> 0.0>-0.0
false

julia> 0.0<-0.0
false

julia> NaN==NaN
false

julia> NaN>=NaN
false

julia> NaN<=NaN
false

julia> Inf==Inf
true

julia> Inf==-Inf
false

julia> -Inf==-Inf
true

julia> Inf>-Inf
true

julia> Inf<-Inf
false

julia> Inf>NaN
false

julia> Inf<NaN
false

julia> Inf>100000
true

julia> -Inf<-1000000
true

julia> -Inf>-1000000
false





Previous                                                 Next                                                 Home

No comments:

Post a Comment