precision demo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <iostream>
using namespace std;
int main( )
{
double d = 7;
cout << d << endl;
for (int i = 0; i < 10; i++)
{
d -= 0.7;
cout << d << endl;
}
if (d == 0.0) cout << "Yes";
else cout << "No" << endl;
cout << d << endl;
}