4 ms·
This has nothing to do with C vs. C++. It's a fundamental limitation of floating point arithmetic. Here is the Taylor series of \exp: \exp(x) = 1 + x + higher
by namirez 7y ago
This has nothing to do with C vs. C++. It's a fundamental limitation of floating point arithmetic. Here is the Taylor series of \exp:
\exp(x) = 1 + x + higher order terms.
Sometimes you can represent x by a floating number but 1+x will be 1 because the difference has to go from exponent into mantissa. This happens when the number is between these two values:
(std::numeric_limits<T>::lowest, std::numeric_limits<T>::epsilon)