Re: [heycam/webidl] Clarify that unrestricted doubles and floats include NaNs. (#393)

bzbarsky commented on this pull request.



> @@ -5144,7 +5144,7 @@ The [=type name=] of the
 
 The {{unrestricted float}} type is a floating point numeric
 type that corresponds to the set of all possible single-precision 32 bit
-IEEE 754 floating point numbers, finite and non-finite.  [[!IEEE-754]]
+IEEE 754 floating point numbers, finite, non-finite, and special "not a number" values (NaNs). [[!IEEE-754]]

You can obviously type-pun bytes into a float via typed arrays, get a NaN out via the float view and still see whatever underlying bytes in the byte view.  But if you try to get the bytes out of the NaN (e.g. by storing the NaN into a float array and then looking at the resulting byte view), you always get the same bit pattern.

In particular, https://tc39.github.io/ecma262/#sec-rawbytestonumber step 3 ensures that whatever byte pattern in the underlying storage reading a NaN from a float array ensures that you have the canonical NaN value.

Similarly, https://tc39.github.io/ecma262/#sec-numbertorawbytes says that NaN is converted to the same byte pattern every time, as far as I can tell.  But I'm not sure what "implementation distinguishable" is supposed to mean there; it's not really defined...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/393#discussion_r130634667

Received on Tuesday, 1 August 2017 15:07:13 UTC