On Mon, Nov 23, 2020 at 04:26:20PM -0500, Wes Turner wrote:
Is there a different IEEE spec or CAS that distinguishes between 1/x and 2/x where x=0?
No. x/0.0 would either signal an error (in Python terms: raise an exception) or return a NAN. The specific NAN it might return is not set by the IEEE-754 standard. Although IEEE-754 allows NANs to transmit debugging information in the form of the NAN payload, it doesn't mandate it, and few maths libraries do so. So in principle 1/0.0 and 2/0.0 could return two NANs with different payloads, but it's not required.
assert 1/0 != 2/0 != math.inf/0
Since NANs always compare unequal with each other, regardless of the payload, that assertion would always pass even if the NANs were the same NAN. -- Steve