Julia provides following function to
check for special values Inf, -Inf, Nan etc.,
Function
|
Description
|
isequal(x, y)
|
Return true, if both x and y are
equal.
isequal(0.0, -0.0) return false.
isequal(NaN, NaN) return true.
|
isfinite(x)
|
Return true, if the number is finite,
else false.
|
isinf(x)
|
Return true, if the number is
infinite, else false.
|
isnan(x)
|
Return true, if x is not a number,
else false.
|
isequal(x,y)
example
julia> isequal(10,10) true julia> isequal(NaN, NaN) true julia> isequal(0.0,-0.0) false julia> 0.0==-0.0 true julia> isequal(Inf, Inf) true julia> isequal(Inf, -Inf) false julia> isequal(Inf, Inf16) true
Other examples
julia> isfinite(10) true julia> isfinite(10/0) false julia> isinf(10/0) true julia> isinf(10) false julia> isnan(10) false julia> isnan(Inf/Inf) true
No comments:
Post a Comment