/* This is a double precision version of Example 2. The results of this program are accurate. */ #include #include using namespace std; double f( double x ) { return( (1.0 - cos(x)) / (x*x) ); } int main() { double x = 0.1; cout << x << ", " << f(x) << endl; x = 0.01; cout << x << ", " << f(x) << endl; x = 0.001; cout << x << ", " << f(x) << endl; x = 0.0001; cout << x << ", " << f(x) << endl; x = 0.00001; cout << x << ", " << f(x) << endl; cout << "\n\n"; system( "PAUSE" ); // This line is system dependent return( 0 ); }