Is there anything in the C++ standard (or the IEEE 754 floating-point standard) that guarantees that 1./std::numeric_limits<double>::infinity()
is zero (or at least a small number)?
The C++ infinity is written as “INF” and it accrues in the outcome of dividing a positive numeric value by a null value or calculating a numeric value that is greater than the larger number of our system that can be represented in 64 bits.
Any finite number divided by infinity results in zero under IEEE 754 (and therefore the same in most typical C++ implementations).
If the sign of the of numerator and denominator differ, the result will be negative zero, which is equal to zero.
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