Forum Discussion
Why 4 equals 5?
Hello Rolf
That's the famous Floating Point Error.
Tutorial to Understand IEEE Floating-Point Errors
How To Implement Custom Rounding Procedures
IEEE floating point (Wikipedia)
Floating Point Numbers - Computerphile (with Tom Scott)
- Rolf HansmannFeb 10, 2017Copper Contributor
I thought a dividing operation is required to get an floating point error. This is a minus operation??
- Detlef_LewinFeb 10, 2017Silver Contributor
Well, you thought incorrectly.
The kind of arithmetic operation does not matter.
- Rolf HansmannFeb 11, 2017Copper Contributor
and what to do about it if it occurs at the 2 place after the decimal point and other programs like Spss or SAS are calculating it right. i might be wrong but for me it seems other programmers where able to avoid it by better implementing the algorithms or using a better library.
I calculated this with many programs and you find right and wrong.