6 * Example from Kahan's "Why is Floating-Point Computation so Hard to Debug when it Goes Wrong?"
7 * Published on Kahan's website, March 2007 http://www.cs.berkeley.edu/~wkahan/WrongR.pdf
8 * In this example we compute h(x) = |x| ... except it is not!
9 * Note that the errors are NOT due to catastrophic cancellation (no subtraction) or division (no division) or accumulated rounding (only 128 operations)
10 * http://www.cs.berkeley.edu/~wkahan/WrongR.pdf
16 for (int k = 0; k < 128; ++k)
21 for (int k = 0; k < 128; ++k)
28 int main(int argc, char ** argv)
30 for (Real x = -2; x < 2; x+=1e-3)
32 printf("%lf\t%lf\t%lf\n", x, Float(h(x)), abs(Float(x)));