logoalt Hacker News

oasisaimlesslyyesterday at 7:18 PM1 replyview on HN

I don't think this is true. Modulo the sign bit, the "next float" operator is equivalent to the next bitstring or the integer++.


Replies

kbolinoyesterday at 8:57 PM

Sure, but that operator can propagate a carry all the way to the most significant bit, so a check for bitwise equality after "strip[ping] few least significant bits" will yield false in some cases. The pathologically worst case for single precision, for example, is illustrated by the value 2.0 (bitwise 0x40000000) and its predecessor, which differ in all bits except the sign.