isfinite
isfinite(f) -> Bool
Test whether a number is finite
Examples
-
Check if a number is finite:
julia> isfinite(10.5) true
This example checks if the number
10.5
is finite, which returnstrue
. -
Verify if a negative number is finite:
julia> isfinite(-3.2) true
It confirms whether the negative number
-3.2
is finite, returningtrue
. -
Handle non-finite values like infinity:
julia> isfinite(Inf) false
This example checks if the value
Inf
(representing infinity) is finite, which returnsfalse
. - Check if a complex number is finite:
julia> isfinite(2 + 3im) true
It tests whether the complex number
2 + 3im
is finite, returningtrue
.
Common mistake example:
julia> isfinite(NaN)
true
In this example, the function returns true
for NaN
(Not a Number), which might be unexpected. It's important to note that NaN
is considered finite in Julia.
See Also
digits, inf, isdigit, iseven, isfinite, isless, islower, isnumber, isodd, isprime, isqrt, issorted, issubnormal, isxdigit, nan,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.