isinf
isinf(f) -> Bool
Test whether a number is infinite
Examples
- 
Check if a number is infinite: julia> isinf(5.0) falseThis example checks if the number 5.0is infinite. Since5.0is not infinite, it returnsfalse.
- 
Determine if a negative number is infinite: julia> isinf(-Inf) trueHere, the function isinfis used to check if the negative infinity value-Infis considered infinite. It returnstrueas-Infis indeed infinite.
- 
Check if a positive value is infinite: julia> isinf(1.0 / 0.0) trueIn this example, the expression 1.0 / 0.0is evaluated, which results in a positive infinity value. Theisinffunction correctly identifies it as infinite and returnstrue.
Common mistake example:
julia> isinf("hello")
ERROR: MethodError: no method matching isinf(::String)In this example, the isinf function is applied to a string "hello". However, isinf is meant to check for infinity in numbers, not strings. Ensure that the argument provided to isinf is a valid numeric value to avoid such errors.
See Also
all, all!, angle, any, any!, falses, ifelse, is, isinf, isinteger, isnan, isperm, ispow2, isreal, trues,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.
