I want to know how to subtract IEEE 754 numbers so I searched about this and found this answer: How to subtract IEEE 754 numbers? , and it works fine with all the examples I've tried, except when I substract one, the number 1 have a lot of 0's in the mantissa, so by this logic a number should stay the same when I substract 1 to it?
PS: It would be the same for any number - 2^something, the mantissa would be full of 0's.
Someone explain pls
When an IEEE 754 number is stored, it uses a very memory-efficient method.
All numbers except for very very small ones (so-called de-normalized numbers) can be written in the form:
sign * 1.mmmmmmmmmmmmmmmmm * 2^eeeee
When they are stored, only the seeeeeeeemmmmmmmmmmmmmmmmmmmmmmm
bits are actually stored.
When storing 1.0000000
, the mmmmmmm
bits are all zero, and the leading 1.
is not stored, since that would be redundant. Therefore the mantissa in the stored bits is all-zeros. The mathematical value of the mantissa though is:
mantissa = 1 + 0.mmmmmmm
Actually, the exponent is also stored a little differently, to allow for both positive and negative exponents. But that's outside the scope of this question.
For more information, see the Wikipedia article on this subject .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.