On 2014-07-08 17:57, Steven D'Aprano wrote: [snip] > > In particular, reflexivity for NANs was dropped for a number of reasons, > some stronger than others: > > - One of the weaker reasons for NAN non-reflexivity is that it preserved > the identity x == y <=> x - y == 0. Although that is the cornerstone > of real arithmetic, it's violated by IEEE-754 INFs, so violating it > for NANs is not a big deal either. > > - Dropping reflexivity preserves the useful property that NANs compare > unequal to everything. > > - Practicality beats purity: dropping reflexivity allowed programmers > to identify NANs without waiting years or decades for programming > languages to implement isnan() functions. E.g. before Python had > math.isnan(), I made my own: > > def isnan(x): > return isinstance(x, float) and x != x > > - Keeping reflexivity for NANs would have implied some pretty nasty > things, e.g. if log(-3) == log(-5), then -3 == -5. > The log of a negative number is a complex number. > > Basically, and I realise that many people disagree with their decision > (notably Bertrand Meyer of Eiffel fame, and our own Mark Dickenson), the > IEEE-754 committee led by William Kahan decided that the problems caused > by having NANs compare unequal to themselves were much less than the > problems that would have been caused without it. >
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4