//g++ 5.4.0
#include <iostream>
int main()
{
std::cout << "Hello, world!\n";
std::cout << (int)0.9999999999999999 << std::endl; // 16 digits after decimal
std::cout << (int)0.99999999999999999 << std::endl; // 17 digits after decimal
}
Output:
Hello, world!
0
1
Why does this happen?