4 ms·
> 0 and -0 being distinct values is honestly just an accident of convenience with how floats are stored That's not at all true. The inclusion of negative zero
by moonchild 3y ago
> 0 and -0 being distinct values is honestly just an accident of convenience with how floats are stored
That's not at all true. The inclusion of negative zero in ieee 754 was a deliberate design choice, and if it were considered desirable that zero should be unsigned, then the bit pattern assigned to -0 would not have been so assigned. See 'much ado about nothing's sign bit'[0], by one of the principal authors of ieee 754.
Whereas -0 and +0 are not operationally equivalent, operational equivalence is an important and useful relation; see the very pattern matching example linked from the OP[1].
0. https://people.freebsd.org/~das/kahan86branch.pdf https://people.freebsd.org/~das/kahan86branch.pdf
1. https://erlangforums.com/t/total-term-order/2477/41 https://erlangforums.com/t/total-term-order/2477/41
- andreareina 3y agoThat is a phenomenal title.
- kragen 3y agounfortunately this scan of kahan's chapter is missing some pages