3 ms·
Rounding error is not the only source of error with floating point. There is also loss of significance, which in the worst case is called catastrophic cancellat
by chongli 6y ago
Rounding error is not the only source of error with floating point. There is also loss of significance, which in the worst case is called catastrophic cancellation [1]. This occurs when subtracting two numbers which are very close in magnitude, for example:
1.23456789 - 1.23456788 = 0.00000001 = 1 * 10^-8
So here we’ve gone from 9 significant figures down to 1. This phenomenon will make a naïve Taylor series approximation of e^x be very inaccurate for negative x, due to the sign alternating between positive and negative on every term, causing a lot of catastrophic cancellation.
[1] https://en.wikipedia.org/wiki/Loss_of_significance https://en.wikipedia.org/wiki/Loss_of_significance
- saagarjha 6y ago(Note that in your example no accuracy is lost)