/* n1_error.c test what is the error in approximating exp(x) - 1 by x. WHFS, 3 March 2009 */ #include #include void main (void) { double r, x, y; int i; for (i = -50; i <= 50; i++) { x = 0.02 * i; y = expm1(x); r = (i == 0) ? 0.0 : fabs(y/x - 1.0); printf ("%g\t%g\n", x, r); } }