#include #include using namespace std; int main() { double a = 0.1; double eighth_root = sqrt(sqrt(sqrt(a))); double b = pow(eighth_root, 8.0); // uncomment the following line and it will _look_ like b is 0.1, // but in fact that is because of internal rounding //cout << "a = " << a << ", 8th root of a to the 8th power: " << b << endl; if ( a + b == 0.2 ) cout << "Yes, arithmetic works." << endl; else cout << "0.1 + 0.1 is NOT 0.2 in doubles." << endl; return 0; }