News for hackers. Stuff that matters.
Re:Signed Integers Are Two’s Complement by garmaine on Wednesday May 30, 2018 @11:18PM (#17193708)
In addition to what's mentioned in the already great sibling comments, it's worth noting that IEEE floating point is signed-magnitude.
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.
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)
Re:Signed Integers Are Two’s Complement by nhaehnle on Thursday May 31, 2018 @04:54AM (#17194950)
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).

Re:Signed Integers Are Two’s Complement by garmaine on Thursday May 31, 2018 @04:05PM (#17199713)
Would have been nice if IEEE stored the complement sign.
Re:Signed Integers Are Two’s Complement by exDM69 on Thursday May 31, 2018 @02:38AM (#17194394)
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).
Re:Signed Integers Are Two’s Complement by p1mrx on Thursday May 31, 2018 @12:22AM (#17193929)
It doesn't seem odd to me. When describing things in nature, (+x, -x) tend to have more symmetry than (x, 1/x).
Re:Signed Integers Are Two’s Complement by jovial_cavalier on Wednesday May 30, 2018 @11:49PM (#17193807)
Is there a good way to represent floating points in order to do complement arithmetic?
Re:Signed Integers Are Two’s Complement by garmaine on Wednesday May 30, 2018 @11:56PM (#17193828)
Re:Signed Integers Are Two’s Complement by dbaupp on Thursday May 31, 2018 @12:02AM (#17193851)
JS is IEEE754, not a (one's or two's) complement-based representation.
Re:Signed Integers Are Two’s Complement by garmaine on Thursday May 31, 2018 @04:04PM (#17199700)
Ah I misunderstood the question.
Re:Signed Integers Are Two’s Complement by hamiltonkibbe on Thursday May 31, 2018 @12:38AM (#17193997)
If you know a bit about the range you need to support you could use a fixed point representation