Skip to content

Commit

Permalink
fix(float‑types): Use “with an associated” instead of “associated with”
Browse files Browse the repository at this point in the history
  • Loading branch information
ExE-Boss committed Mar 22, 2020
1 parent 8ac089c commit ea24af3
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -5972,7 +5972,8 @@ type that corresponds to the set of finite single-precision 32 bit
IEEE 754 floating point numbers. [[!IEEE-754]]

When defined with the [{{Unrestricted}}] [=extended attribute=], the {{float}} type
additionally corresponds to IEEE 754 non-finite, and special "not a number" values (NaNs). [[!IEEE-754]]
additionally corresponds to the single-precision 32 bit IEEE 754 non-finite,
and special "not a number" values (NaNs). [[!IEEE-754]]

{{float}} constant values in IDL are
represented with <emu-t class="regex"><a href="#prod-decimal">decimal</a></emu-t>
Expand All @@ -5997,7 +5998,8 @@ type that corresponds to the set of finite double-precision 64 bit
IEEE 754 floating point numbers. [[!IEEE-754]]

When defined with the [{{Unrestricted}}] [=extended attribute=], the {{double}} type
additionally corresponds to IEEE 754 non-finite, and special "not a number" values (NaNs). [[!IEEE-754]]
additionally corresponds to the double-precision 64 bit IEEE 754 non-finite,
and special "not a number" values (NaNs). [[!IEEE-754]]

{{double}} constant values in IDL are
represented with <emu-t class="regex"><a href="#prod-decimal">decimal</a></emu-t>
Expand Down Expand Up @@ -7125,8 +7127,8 @@ ECMAScript value type.
return the {{boolean}} value that represents the same truth value.
1. If <a abstract-op>Type</a>(|V|) is Number, then
return the result of <a href="#es-to-double">converting</a> |V|
to an {{double}} [=extended attribute associated with|associated with=]
the [{{Unrestricted}}] [=extended attribute=].
to a {{double}} [=extended attribute associated with|with an associated=]
[{{Unrestricted}}] [=extended attribute=].
1. If <a abstract-op>Type</a>(|V|) is String, then
return the result of <a href="#es-DOMString">converting</a> |V|
to a {{DOMString}}.
Expand Down Expand Up @@ -7436,8 +7438,8 @@ In effect, where <var ignore>x</var> is a Number value,
to an IDL {{float}} value by running the following algorithm:

1. Let |x| be [=?=] <a abstract-op>ToNumber</a>(|V|).
1. If the conversion is to an IDL type [=extended attribute associated with|associated with=]
the [{{Unrestricted}}] [=extended attribute=], then:
1. If the conversion is to an IDL type [=extended attribute associated with|with an associated=]
[{{Unrestricted}}] [=extended attribute=], then:
1. If |x| is <emu-val>NaN</emu-val>, then
return the IDL {{float}} value that represents
the IEEE 754 NaN value with the bit pattern 0x7fc00000 [[!IEEE-754]].
Expand All @@ -7451,8 +7453,8 @@ In effect, where <var ignore>x</var> is a Number value,
<em>even significand</em> if there are two [=equally close values=].
(The two special values 2<sup>128</sup> and −2<sup>128</sup>
are considered to have even significands for this purpose.)
1. If the conversion is to an IDL type [=extended attribute associated with|associated with=]
the [{{Unrestricted}}] [=extended attribute=], then:
1. If the conversion is to an IDL type [=extended attribute associated with|with an associated=]
[{{Unrestricted}}] [=extended attribute=], then:
1. If |y| is 2<sup>128</sup>, return +∞.
1. If |y| is −2<sup>128</sup>, return −∞.
1. Else, if |y| is 2<sup>128</sup> or −2<sup>128</sup>, then [=ECMAScript/throw=] a {{ECMAScript/TypeError}}.
Expand All @@ -7470,8 +7472,8 @@ value when its bit pattern is interpreted as an unsigned 32 bit integer.
an IDL {{float}} value to an ECMAScript
value is a Number:

1. If the conversion is from an IDL type [=extended attribute associated with|associated with=]
the [{{Unrestricted}}] [=extended attribute=], then:
1. If the conversion is from an IDL type [=extended attribute associated with|with an associated=]
[{{Unrestricted}}] [=extended attribute=], then:
1. If the IDL {{float}} value is a NaN,
then the Number value is <emu-val>NaN</emu-val>.
1. Else, assert: The IDL {{float}} value is not a NaN, +∞ or −∞.
Expand All @@ -7489,8 +7491,8 @@ value when its bit pattern is interpreted as an unsigned 32 bit integer.
to an IDL {{double}} value by running the following algorithm:

1. Let |x| be [=?=] <a abstract-op>ToNumber</a>(|V|).
1. If the conversion is to an IDL type [=extended attribute associated with|associated with=]
the [{{Unrestricted}}] [=extended attribute=], then:
1. If the conversion is to an IDL type [=extended attribute associated with|with an associated=]
[{{Unrestricted}}] [=extended attribute=], then:
1. If |x| is <emu-val>NaN</emu-val>, then
return the IDL {{double}} value that represents
the IEEE 754 NaN value with the bit pattern 0x7ff8000000000000 [[!IEEE-754]].
Expand All @@ -7510,8 +7512,8 @@ value when its bit pattern is interpreted as an unsigned 64 bit integer.
an IDL {{double}} value to an ECMAScript
value is a Number:

1. If the conversion is from an IDL type [=extended attribute associated with|associated with=]
the [{{Unrestricted}}] [=extended attribute=], then:
1. If the conversion is from an IDL type [=extended attribute associated with|with an associated=]
[{{Unrestricted}}] [=extended attribute=], then:
1. If the IDL {{double}} value is a NaN,
then the Number value is <emu-val>NaN</emu-val>.
1. Else, assert: The IDL {{double}} value is not a NaN, +∞ or −∞.
Expand Down Expand Up @@ -10691,12 +10693,12 @@ for the specific requirements that the use of
<pre highlight="webidl">
[Exposed=Window]
interface GraphicsContext {
void setColorFloat(double red, double green, double blue);
void setColorUnrestrictedFloat([Unrestricted] double red, [Unrestricted] double green, [Unrestricted] double blue);
void setColorDouble(double red, double green, double blue);
void setColorUnrestrictedDouble([Unrestricted] double red, [Unrestricted] double green, [Unrestricted] double blue);
};
</pre>

In an ECMAScript implementation of the IDL, a call to setColor3f with
In an ECMAScript implementation of the IDL, a call to setColorDouble with
Number values that are out of range for a
{{double}} will result in an exception being
thrown.
Expand All @@ -10706,14 +10708,14 @@ for the specific requirements that the use of
var context = getGraphicsContext();

// Calling the [Unrestricted] version uses allows NaN and non-finite numbers values:
context.setColorUnrestrictedFloat(NaN, +Infinity, -Infinity);
context.setColorUnrestrictedDouble(NaN, +Infinity, -Infinity);

// When setColorFloat is called, floating point values are allowed:
context.setColorFloat(-0.9, 1, 1.1);
// When setColorDouble is called, floating point values are allowed:
context.setColorDouble(-0.9, 1, 1.1);

// The following will cause a TypeError to be thrown, since NaN and non-finite
// number values are not allowed when [Unrestricted] is not specified:
context.setColorFloat(NaN, +Infinity, -Infinity);
context.setColorDouble(NaN, +Infinity, -Infinity);
</pre>
</div>

Expand Down

0 comments on commit ea24af3

Please sign in to comment.