#include <bits/stdc++.h>
using namespace std;
int main() {
cout << fixed << setprecision(10);
double p;
cin >> p;
cout << p << " ";
p = p * 1000;
cout << p << " ";
int r = floor(p);
cout << r << endl;
return 0;
}
input: 1036.456
output: 1036.4560000000 1036455.9999999999 1036455
I'm using the online compiler on ideone.
Why is the second number 1036455.9999999999and not
1036456` as I would expect?