Re:Signed Integers Are Two’s Complement
by userbinator on Thursday May 31, 2018 @12:06AM
(#17193867)
Sign-magnitude for the significand, and offset-binary for the exponent. The reason for this odd combination is probably historical.
[ Parent
| on HN ]
Re:Signed Integers Are Two’s Complement
by akrasuski1 on Thursday May 31, 2018 @12:36AM
(#17193989)
It's done so that the bits will compare the same way whether treated as float or int. (modulo NaNs and stuff)
That is only true for non-negative floating point numbers. It's still useful though.
Interestingly, posits as originally proposed do have this property (except for infinity).
Would have been nice if IEEE stored the complement sign.
It's also practical for hw implementation and has other nice qualities. E.g. comparisons and sorting are easy. Radix sort works for floating point (with some bit magic). Terms and conditions may apply (oddities w.r.t. INF, Nan, etc).