int main(void) { double x; x = (1.0e17 + 5.0) - 1.0e17; printf("%lf \n", x); return 0; }
int main(void) { double x; x = (1.0e16 + 5.0) - 1.0e16; printf("%lf \n", x); return 0; }
int main(void) { double x; x = (1.0e15 + 5.0) - 1.0e15; printf("%lf \n", x); return 0; }
When EXP is on the 17th, 0 will be printed When EXP is 16, 4 is printed out When the EXP is 15, 5 is output.
It seems to be output normally when it is EXP15, but why does the value come out weird from above 16?
double
Here's what Wikipedia says.
Just as 1.0e1 is a two-digit number with 10, for 1.0e15, 16 digits for 1.0e15, 17 digits for 1.0e16, and 18 digits for 1.0e17. So it's beyond the scope of what Double can handle. This phenomenon is often referred to as overflow. When this overflow occurs, the value changes randomly.(Of course, it depends on the mod's rules.)
If you look for the rest more about overflow, it would be helpful.
Wikipedia links corresponding to the image above.
(https://ko.wikipedia.org/wiki/C_%EC%96%B8%EC%96%B4_%EC%8B%A4%EC%88%98%ED%98%95_%EB%B3%80%EC%88%98)
620 Uncaught (inpromise) Error on Electron: An object could not be cloned
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.