/* float_error.cpp - We see that using float gives rise to
	round-off errors. Using double in this case eliminates
	the error. Unfortunately round-off errors will come back
	if we do a sufficiently complex operation.
 */

#include <iostream>
using namespace std;

int main()
{
	float sum = 0.0;

       for (int k = 1; k <= 10000; ++k) {
		sum += 0.1;
	}
	cout << sum << endl;

        double w = 0.0;
	for (int h = 1; h <= 10000; ++h) {
		w += 0.1;
	}
	cout << w << endl;

}
/* I got the output:
   999.903
   1000  
 */
