my compiler has


#include <cmath>
#include <iostream>

int main()
{

cout << "First:" << (123456 / pow(10.0, 3)) << endl;
cout << "Second:" << (123456 / pow(10.0, 3)) << endl;

if ( (123456 / pow(10.0,3)) == (123456/pow(10.0,3)))
cout << "(123456/pow(10.0,3)) == (123456/pow(10.0,3))" << endl;
else
cout << "(123456/pow(10.0,3)) != (123456/pow(10.0,3))" << endl;

if (123.456 == 123.456)
cout << "123.456 == 123.456" << endl;
else
cout << "123.456 != 123.456" << endl;

if (pow(10.0, 3) == pow(10.0, 3))
cout << "pow(10.0,3) == pow(10.0, 3)" << endl;
else
cout << "pow(10.0,3) != pow(10.0, 3)" << endl;
};


With output
First:123.456
Second:123.456
(123456/pow(10.0,3)) == (123456/pow(10.0,3))
123.456 == 123.456
pow(10.0,3) == pow(10.0, 3)

thoughts -

  1. It's a rounding issue - .99999 != 1
  2. A binary issue ... trying to represent .1 in binary somewhere
  3. A typo? ()?