What is the method for testing whether a double (or integer) is infinity, for example when 1/0 operation is performed?
isfinite(n) does not seem to work.
You may check
if(d == INFINITY) {}
or
if(d > DBL_MAX) {}
INFINITY
is a constant float expression defined in math.h
representing positive infinity; DBL_MAX
is a constant defined in float.h
representing the largest double that can be represented.
Check also here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With