2 ms·
Floating-point numbers are also directly supported by hardware, but they carved a few values for NaN, negative and positive infinity, and negative and positive
by nine_k 3y ago
Floating-point numbers are also directly supported by hardware, but they carved a few values for NaN, negative and positive infinity, and negative and positive zero.
I don't see why integers should not have something similar, especially large enough integers, like i64 or even i32. Historically they don't though.
- GrumpySloth 3y agoFloating point numbers also don’t obey normal algebra laws and are notoriously tricky to get right. Two’s complement on the other hand form an honest-to-god commutative ring, their implementation is dead simple and it’s very rare that they lead to bugs in and out of themselves. They’re one of the most beautiful solutions in computer science IMO. I’d give up floating point much more readily than two's complement.