3 ms·
In addition to what's mentioned in the already great sibling comments, it's worth noting that IEEE floating point is signed-magnitude.
by garmaine 8y ago
In addition to what's mentioned in the already great sibling comments, it's worth noting that IEEE floating point is signed-magnitude.
- jovial_cavalier 8y agoIs there a good way to represent floating points in order to do complement arithmetic?
- garmaine 8y agoYes, see JavaScript: https://www.w3schools.com/js/js_numbers.asp https://www.w3schools.com/js/js_numbers.asp
- hamiltonkibbe 8y agoIf you know a bit about the range you need to support you could use a fixed point representation
- userbinator 8y agoSign-magnitude for the significand, and offset-binary for the exponent. The reason for this odd combination is probably historical.
- p1mrx 8y agoIt doesn't seem odd to me. When describing things in nature, (+x, -x) tend to have more symmetry than (x, 1/x).
- akrasuski1 8y agoIt's done so that the bits will compare the same way whether treated as float or int. (modulo NaNs and stuff)
- exDM69 8y agoIt'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).