[Python-ideas] math.inf and math.nan constants
abarnert at yahoo.com
Sat Jan 10 12:18:55 CET 2015
On Jan 10, 2015, at 2:23, Steven D'Aprano <steve at pearwood.info> wrote:
> As it stands now, there are two of each NAN, one with the sign bit set
> and one without, and the standard doesn't specify any meaning to that.
Yeah, I think the current version says that implementations must ignore the sign bit, and users should ignore it. (I don't have the spec in front of me right now, so I'm going by memory here.)
> Are there now any restrictions or standards for what the NAN payloads
IIRC, the short version is as few restrictions as possible on the user, and whatever restrictions are needed on implementations to make that true. Something like:
* Implementations shouldn't assign any meaning to the payload beyond the quiet bit.
* NaN-on-number ops should preserve the entire NaN payload. (I forget what NaN-on-NaN ops do, but I assume it's preserving one or the other.)
* If quiet bit is used, it must be x86/etc.-style (set means quiet).
* Signaling-to-quiet conversions should leave the other bits alone.
More information about the Python-ideas