Re: [heycam/webidl] Refactor integer conversion in ES bindings. (#235)

domenic approved this pull request.

LGTM with a couple more nits, and I guess we'll want to fix the Issue: text about clamping first. Very nice stuff.

> +    1.  If |bitLength| is 64, then:
+        1.  Let |upperBound| be 2<sup>53</sup> − 1.
+        1.  If |signedness| is "unsigned", then let |lowerBound| be 0.
+        1.  Otherwise let |lowerBound| be −2<sup>53</sup> + 1.
+
+            Note: in ECMAScript, all numbers including integers are represented as
+            double-precision 64 bit IEEE 754 floating point numbers.
+
+            Issue: Complete this explanation once I understand why we're only concerned
+            about this when clamping and not for all values.
+
+    1.  Otherwise, if |signedness| is "unsigned", then:
+        1.  Let |lowerBound| be 0.
+        1.  Let |upperBound| be 2<sup>|bitLength|</sup> − 1.
+    1.  Otherwise:
+        1.  Let |lowerBound| be -2<sup>|bitLength − 1|</sup>.

|s need to be around bitLength, not bitLength - 1

> @@ -7042,9 +6924,9 @@ value when its bit pattern is interpreted as an unsigned 32 bit integer.
     An ECMAScript value |V| is [=converted to an IDL value|converted=]
     to an IDL {{double}} value by running the following algorithm:
 
-    1.  Let |x| be [=ToNumber=](|V|).
-    1.  If |x| is <emu-val>NaN</emu-val>, <emu-val>+Infinity</emu-val> or
-        <emu-val>−Infinity</emu-val>, then <a lt="es throw">throw a <emu-val>TypeError</emu-val></a>.
+    1.  Let |x| be [=?=] [=ToNumber=](|V|).
+    1.  If |x| is <emu-val>NaN</emu-val>, +∞, or −∞,
+        then <a lt="es throw">throw a <emu-val>TypeError</emu-val></a>.
     1.  Return the IDL {{double}} value
         that has the same numeric value as |x|.
 </div>

Unrestricted double should also get ?

-- 
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/235#pullrequestreview-8272992

Received on Friday, 11 November 2016 22:01:23 UTC