Cancellation: the subtraction between the similar numbers, the addtion/subtraction between the relative large number and relative small number, and the division by the small number.
For the machine epsilon ϵ, (1+ϵ)−(1−ϵ)=1−1=0 although it should be 2ϵ in the real mathematics.
For quadratic formula 2a−b±b2−4ac, when b>0 and b2≫ac, −b±b2−4ac part is numerically unstable.
For performance, a standard deviation σ
where x is the mean of n-points x1,⋯,xn, can be replaced by n−11(i=1∑nxi2−nx2)
However, it can be numerically unstable in (∑i=1nxi2−nx2) part, and it can be even negative.
For a=1.1 and x=123456.789, (x+a)−x may not be the same as a.
a=1.1x=123456.789x+a(x+a)−x⟹30011F111181000C1100C1100C1100C1100D1101:(1.f1…f23)20form⟹4010070111F11111000120010000006011050101:(1.f1…f23)216form=01000111111100010010000001100101+010001111appeared 16-bit number00000000000000010001100loss1100110011001101=01000111111100010010000001100101+01000111100000000000000010001101(round-to-nearest)=4010070111F1111100012001000000F111120010=01000111111100010010000011110010−01000111111100010010000001100101=010001111should be shifted00000000000000010001101=30011F111181000D110100000000000000000000=30011F111181000C1100C1100C1100C1100D1101=a
In this example, (x+a)−x=a after the addition between the relative large number and relative small number (x+a part), and the subtraction between the similar numbers((x+a)−x part). Therefore, this calculation is numerically unstable.
Keep going!Keep going ×2!Give me more!Thank you, thank youFar too kind!Never gonna give me up?Never gonna let me down?Turn around and desert me!You're an addict!Son of a clapper!No wayGo back to work!This is getting out of handUnbelievablePREPOSTEROUSI N S A N I T YFEED ME A STRAY CAT