Original Post
here's a simple program:
#include <iostream.h>
#include <math.h>
int main()
{
double btmTotal = 33.3 + 33.3 + 33.3 + 0.1;
// Test 1
if (btmTotal < 100)
cout << "<";
else if (btmTotal>100)
cout << ">";
else if (btmTotal == 100)
cout << "==";
cout << endl;
// Test 2
if (ceil(btmTotal) < 100)
cout << "<";
else if (ceil(btmTotal)>100)
cout << ">";
else if (ceil(btmTotal)==100)
cout << "==";
cout << endl;
return 0;
}
Test 1 has "<" printed, but Test 2 has "==" printed. Why?
"Success is not the result of spontaneous combustion; you must set yourself on fire."
Edited by - nazpyro on October 17, 2001 3:31:42 PM
Edited by - nazpyro on October 17, 2001 3:32:02 PM
Edited by - nazpyro on October 17, 2001 3:32:26 PM