5 ms·
Integers can be represented exactly in IEEE754.
by aaaaaaaaaab 8y ago
Integers can be represented exactly in IEEE754.
- maxxxxx 8y agoHow about 2.1? According to this https://www.h-schmidt.net/FloatConverter/IEEE754.html https://www.h-schmidt.net/FloatConverter/IEEE754.html 2.1 will be represented as 2.099999904632568359375
- noselasd 8y agowell, 2.1 isn't an integer.
- noselasd 8y agoNot all of them, e.g. 9007199254740993 can't be represented in a double precision format (what javascript uses) For single precision floats you start having issues representing integers as low as 16777217
- aaaaaaaaaab 8y agoSure, you can’t represent Graham’s number either... I know you knew what I meant.
- noselasd 8y agoNo not really. You have to define the bounds you were talking about. People believing that a float type can represent all integers that the int type in their language can represent is not exactly uncommon.