
On Thu, Aug 26, 2021 at 11:05:01AM +0200, Marc-Andre Lemburg wrote:
Oh, good point. I was under the impression that NAN is handled as a singleton.
There are 4503599627370496 distinct quiet NANs (plus about the same signalling NANs). So it would need to be 4-quadrillion-ton :-) (If anyone is concerned about the large number of NANs, it's less than 0.05% of the total number of floats.) Back in the mid-80s, Apple's floating point library, SANE, distinguished different classes of error with distinct NANs. Few systems have followed that lead, but each NAN still has 51 bits available for a diagnostic code, plus the sign bit. While Python itself only generates a single NAN value, if you are receiving data from outside sources it could contain NANs with distinct payloads. The IEEE-754 standard doesn't mandate that NANs preserve the payload, but it does recommend it. We shouldn't gratuitously discard that information. It could be meaningful to whoever is generating the data. -- Steve