From b017a801045b9d40780174ab84f560ea1b288e07 Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Wed, 3 Aug 2022 14:41:53 -0700 Subject: [PATCH] Editorial: change dfn for "mathematical value" and add "mathematical value of" (#2822) --- spec.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec.html b/spec.html index 1dbc5f5158..33b7871b7a 100644 --- a/spec.html +++ b/spec.html @@ -1002,8 +1002,8 @@

Static Semantics

Mathematical Operations

This specification makes reference to these kinds of numeric values:

@@ -1014,7 +1014,7 @@

Mathematical Operations

Numeric operators applied to mixed-type operands (such as a Number and a mathematical value) are not defined and should be considered an editorial error in this specification.

This specification denotes most numeric values in base 10; it also uses numeric values of the form 0x followed by digits 0-9 or A-F as base-16 values.

When the term integer is used in this specification, it refers to a mathematical value which is in the set of integers, unless otherwise stated. When the term integral Number is used in this specification, it refers to a Number value whose mathematical value is in the set of integers.

-

Conversions between mathematical values and Numbers or BigInts are always explicit in this document. A conversion from a mathematical value or extended mathematical value _x_ to a Number is denoted as "the Number value for _x_" or 𝔽(_x_), and is defined in . A conversion from an integer _x_ to a BigInt is denoted as "the BigInt value for _x_" or ℤ(_x_). A conversion from a Number or BigInt _x_ to a mathematical value is denoted as "the mathematical value of _x_", or ℝ(_x_). The mathematical value of *+0*𝔽 and *-0*𝔽 is the mathematical value 0. The mathematical value of non-finite values is not defined. The extended mathematical value of _x_ is the mathematical value of _x_ for finite values, and is +∞ and -∞ for *+∞*𝔽 and *-∞*𝔽 respectively; it is not defined for *NaN*.

+

Conversions between mathematical values and Numbers or BigInts are always explicit in this document. A conversion from a mathematical value or extended mathematical value _x_ to a Number is denoted as "the Number value for _x_" or 𝔽(_x_), and is defined in . A conversion from an integer _x_ to a BigInt is denoted as "the BigInt value for _x_" or ℤ(_x_). A conversion from a Number or BigInt _x_ to a mathematical value is denoted as "the mathematical value of _x_", or ℝ(_x_). The mathematical value of *+0*𝔽 and *-0*𝔽 is the mathematical value 0. The mathematical value of non-finite values is not defined. The extended mathematical value of _x_ is the mathematical value of _x_ for finite values, and is +∞ and -∞ for *+∞*𝔽 and *-∞*𝔽 respectively; it is not defined for *NaN*.

The mathematical function abs(_x_) produces the absolute value of _x_, which is -_x_ if _x_ < 0 and otherwise is _x_ itself.

The mathematical function min(_x1_, _x2_, … , _xN_) produces the mathematically smallest of _x1_ through _xN_. The mathematical function max(_x1_, _x2_, ..., _xN_) produces the mathematically largest of _x1_ through _xN_. The domain and range of these mathematical functions are the extended mathematical values.

The notation “_x_ modulo _y_” (_y_ must be finite and non-zero) computes a value _k_ of the same sign as _y_ (or zero) such that abs(_k_) < abs(_y_) and _x_ - _k_ = _q_ × _y_ for some integer _q_.

@@ -1768,7 +1768,7 @@

The Number Type

where _s_ is 1 or -1, _m_ is an integer such that 0 < _m_ < 252, and _e_ is -1074.

Note that all the positive and negative integers whose magnitude is no greater than 253 are representable in the Number type. The integer 0 has two representations in the Number type: *+0*𝔽 and *-0*𝔽.

A finite number has an odd significand if it is non-zero and the integer _m_ used to express it (in one of the two forms shown above) is odd. Otherwise, it has an even significand.

-

In this specification, the phrase “the Number value for _x_” where _x_ represents an exact real mathematical quantity (which might even be an irrational number such as π) means a Number value chosen in the following manner. Consider the set of all finite values of the Number type, with *-0*𝔽 removed and with two additional values added to it that are not representable in the Number type, namely 21024 (which is +1 × 253 × 2971) and -21024 (which is -1 × 253 × 2971). Choose the member of this set that is closest in value to _x_. If two values of the set are equally close, then the one with an even significand is chosen; for this purpose, the two extra values 21024 and -21024 are considered to have even significands. Finally, if 21024 was chosen, replace it with *+∞*𝔽; if -21024 was chosen, replace it with *-∞*𝔽; if *+0*𝔽 was chosen, replace it with *-0*𝔽 if and only if _x_ < 0; any other chosen value is used unchanged. The result is the Number value for _x_. (This procedure corresponds exactly to the behaviour of the IEEE 754-2019 roundTiesToEven mode.)

+

In this specification, the phrase “the Number value for _x_” where _x_ represents an exact real mathematical quantity (which might even be an irrational number such as π) means a Number value chosen in the following manner. Consider the set of all finite values of the Number type, with *-0*𝔽 removed and with two additional values added to it that are not representable in the Number type, namely 21024 (which is +1 × 253 × 2971) and -21024 (which is -1 × 253 × 2971). Choose the member of this set that is closest in value to _x_. If two values of the set are equally close, then the one with an even significand is chosen; for this purpose, the two extra values 21024 and -21024 are considered to have even significands. Finally, if 21024 was chosen, replace it with *+∞*𝔽; if -21024 was chosen, replace it with *-∞*𝔽; if *+0*𝔽 was chosen, replace it with *-0*𝔽 if and only if _x_ < 0; any other chosen value is used unchanged. The result is the Number value for _x_. (This procedure corresponds exactly to the behaviour of the IEEE 754-2019 roundTiesToEven mode.)

The Number value for +∞ is *+∞*𝔽, and the Number value for -∞ is *-∞*𝔽.

Some ECMAScript operators deal only with integers in specific ranges such as -231 through 231 - 1, inclusive, or in the range 0 through 216 - 1, inclusive. These operators accept any value of the Number type but first convert each such value to an integer value in the expected range. See the descriptions of the numeric conversion operations in .