Tag: floating-point
-
How can a big number fit precisely into `double` with 32-bit GCC?
6 Consider the following code: #include <iostream> int main() { long long x = 123456789123456789; std::cout << std::fixed; auto y = static_cast<double>(x); // (1) std::cout << static_cast<long long>(y) << "n"; // (2) std::cout << y << "n"; std::cout << (x == static_cast<long long>(y)) << "n"; // (3) std::cout << static_cast<long long>(static_cast<double>(x)) << "n"; // (4)…