3 ms·
So, IEEE floating point doesn’t support ‘addition’ then.
by jameshart 2y ago
So, IEEE floating point doesn’t support ‘addition’ then.
- samatman 2y agoIEEE 754 defines an exact binary result for the addition of any two floats. That this bit-identical result is not the same operation as addition of real numbers is irrelevant, because floats aren't reals. f1 + f2 is not an estimation. Even treating it as an approximation will get you into trouble. It's not that either, it's a floating-point result, and algorithms making heavy use of floating point had better understand precisely what f1 + f2 is going to give you if they want to obtain maximum precision and accuracy.
- aidenn0 2y agoCool, so next time I have numbers that aren't reals to perform math on, I can use floats.
- samatman 2y agoOr if you have numbers that aren't integers to perform math on, you can use integers. It's not a new problem, and it isn't specific to floats. Computers do discrete math. Always have, always will.