// P. Conrad CISC106 section 99 11/06/2006
// good floating point comparison---compare the abs value of diff with tolerance

#include <iostream>
using namespace std;

#include <cmath>   // for fabs()

int main() 
{

  float number = 1.80;
  float calculation = number * 1.1; // 1.8 + 10% of 1.8

  float expectedanswer = 1.98;   //as we know, 1.8 + 10% of 1.8 = 1.98

  cout <<"Comparing " << calculation <<" and " << expectedanswer << endl;
   
  if ( fabs( calculation - expectedanswer ) < .0001 )
    {
      cout <<"Equal!" <<endl;
    }
    else 
      {
	cout <<"Not Equal!" <<endl;
      }
  cout <<endl;
}

