The abstract operation ToUint32 converts _argument_ to one of 232 integer values in the range 0 through
抽象操作 ToUint32 将 _argument_ 转换为 0 到
Given the above definition of ToUint32:
+鉴于以上 ToUint32 的定义:
The abstract operation ToInt16 converts _argument_ to one of 216 integer values in the range -32768 through 32767, inclusive. This abstract operation functions as follows:
+抽象操作 ToInt16 将 _argument_ 转换为 -32768 到 32767 的 216 个整数之一。这个抽象操作算法如下:
The abstract operation ToUint16 converts _argument_ to one of 216 integer values in the range 0 through
抽象操作 ToUint16 将 _argument_ 转换为 0 到
Given the above definition of ToUint16:
+鉴于以上 ToUint16 的定义:
The abstract operation ToInt8 converts _argument_ to one of 28 integer values in the range -128 through 127, inclusive. This abstract operation functions as follows:
+抽象操作 ToInt8 负责将 _argument_ 转换为 -128 到 127 的 28 个整数之一。这个抽象操作算法如下:
The abstract operation ToUint8 converts _argument_ to one of 28 integer values in the range 0 through 255, inclusive. This abstract operation functions as follows:
+抽象操作 ToUint8 负责将 _argument_ 转换为 0 到 255 的 28 个整数之一。这个抽象操作算法如下:
The abstract operation ToUint8Clamp converts _argument_ to one of 28 integer values in the range 0 through 255, inclusive. This abstract operation functions as follows:
+抽象操作 ToUint8Clamp 负责将 _argument_ 转换为 0 到 255 的 28 个整数之一。这个抽象操作算法如下:
Unlike the other ECMAScript integer conversion abstract operation, ToUint8Clamp rounds rather than truncates non-integer values and does not convert *+∞* to 0. ToUint8Clamp does “round half to even” tie-breaking. This differs from `Math.round` which does “round half up” tie-breaking.
+与其他 ECMAScript 整数转换抽象操作不同。 ToUint8Clamp 对非整数值使用取整而不是截断,并且不会把 *+∞* 转换为 0。
The abstract operation ToString converts _argument_ to a value of type String according to
抽象操作 ToString 负责将 _argument_ 转换为一个 String 类型值,如下
- Argument Type + 参数类型 | - Result + 结果 | ||||||||
---|---|---|---|---|---|---|---|---|---|
- Return `"undefined"`. + 返回 `"undefined"`. | |||||||||
- Return `"null"`. + 返回 `"null"`. | |||||||||
- If _argument_ is *true*, return `"true"`. -If _argument_ is *false*, return `"false"`. +如果 _argument_ 是 *true*, 返回 `"true"`. +如果 _argument_ 是 *false*, 返回 `"false"`. |
|||||||||
- Return NumberToString(_argument_). + 返回 NumberToString(_argument_). | |||||||||
- Return _argument_. + 返回 _argument_. | |||||||||
- Throw a *TypeError* exception. + 抛出一个 *TypeError* 异常. | |||||||||
- Apply the following steps: +应用如下步骤: ToString ( _argument_ )NumberToString ( _m_ )-The abstract operation NumberToString converts a Number _m_ to String format as follows: +抽象操作 NumberToString 负责将一个 Number 类型值 _m_ 转换为 String 类型,步骤如下: NumberToString ( _m_ )* the code units of the decimal representation of the integer abs(_n_-1) (with no leading zeroes)The following observations may be useful as guidelines for implementations, but are not part of the normative requirements of this Standard: +以下结论作为实现的参考可能是有用的,不过他们并不作为规范的要求。
For implementations that provide more accurate conversions than required by the rules above, it is recommended that the following alternative version of step 5 be used as a guideline: +对于提供了比上述转换规则更准确的实现,建议其中第五步参考下面的另一个版本: Implementers of ECMAScript may find useful the paper and code written by David M. Gay for binary-to-decimal conversion of floating-point numbers: -Gay, David M. Correctly Rounded Binary-Decimal and Decimal-Binary Conversions. Numerical Analysis, Manuscript 90-10. AT&T Bell Laboratories (Murray Hill, New Jersey). November 30, 1990. Available as + David M. Gay 编写的二进制转换为十进制中关于浮点数的文章和代码对于 ECMAScript 实现者可能会有帮助: +Gay, David M. Correctly Rounded Binary-Decimal and Decimal-Binary Conversions. Numerical Analysis, Manuscript 90-10. AT&T Bell Laboratories (Murray Hill, New Jersey). November 30, 1990. 相关文章可以在
NumberToString ( _m_ )ToObject ( _argument_ )-The abstract operation ToObject converts _argument_ to a value of type Object according to 抽象操作 ToObject 负责将 _argument_ 转换为 Object 类型的值,见表
|