7.1.3.1.1 RS: MV

字符串到数字值的转换总体上类似于确定数值文字(参见 11.8.3)的数字值,但是一些细节是不同的,因此将字符串数值字面值转换为值的过程的数字类型。 该值由两个步骤确定:首先,从 String 数字文字中导出数学值(MV);第二,该数学值如下所述舍入。 下面没有提供的任何语法符号上的 MV 是 11.8.3.1 定义的符号的 MV。

  • The MV of StringNumericLiteral:::[empty] is 0.
  • The MV of StringNumericLiteral:::StrWhiteSpace is 0.
  • The MV of StringNumericLiteral:::StrWhiteSpaceStrNumericLiteralStrWhiteSpace is the MV of StrNumericLiteral, no matter whether white space is present or not.
  • The MV of StrNumericLiteral:::StrDecimalLiteral is the MV of StrDecimalLiteral.
  • The MV of StrNumericLiteral:::BinaryIntegerLiteral is the MV of BinaryIntegerLiteral.
  • The MV of StrNumericLiteral:::OctalIntegerLiteral is the MV of OctalIntegerLiteral.
  • The MV of StrNumericLiteral:::HexIntegerLiteral is the MV of HexIntegerLiteral.
  • The MV of StrDecimalLiteral:::StrUnsignedDecimalLiteral is the MV of StrUnsignedDecimalLiteral.
  • The MV of StrDecimalLiteral:::+StrUnsignedDecimalLiteral is the MV of StrUnsignedDecimalLiteral.
  • The MV of StrDecimalLiteral:::-StrUnsignedDecimalLiteral is the negative of the MV of StrUnsignedDecimalLiteral. (Note that if the MV of StrUnsignedDecimalLiteral is 0, the negative of this MV is also 0. The rounding rule described below handles the conversion of this signless mathematical zero to a floating-point +0 or -0 as appropriate.)
  • The MV of StrUnsignedDecimalLiteral:::Infinity is 1010000 (a value so large that it will round to +∞).
  • The MV of StrUnsignedDecimalLiteral:::DecimalDigits. is the MV of DecimalDigits.
  • The MV of StrUnsignedDecimalLiteral:::DecimalDigits.DecimalDigits is the MV of the first DecimalDigits plus (the MV of the second DecimalDigits times 10-n), where n is the number of code points in the second DecimalDigits.
  • The MV of StrUnsignedDecimalLiteral:::DecimalDigits.ExponentPart is the MV of DecimalDigits times 10e, where e is the MV of ExponentPart.
  • The MV of StrUnsignedDecimalLiteral:::DecimalDigits.DecimalDigitsExponentPart is (the MV of the first DecimalDigits plus (the MV of the second DecimalDigits times 10-n)) times 10e, where n is the number of code points in the second DecimalDigits and e is the MV of ExponentPart.
  • The MV of StrUnsignedDecimalLiteral:::.DecimalDigits is the MV of DecimalDigits times 10-n, where n is the number of code points in DecimalDigits.
  • The MV of StrUnsignedDecimalLiteral:::.DecimalDigitsExponentPart is the MV of DecimalDigits times 10e-n, where n is the number of code points in DecimalDigits and e is the MV of ExponentPart.
  • The MV of StrUnsignedDecimalLiteral:::DecimalDigits is the MV of DecimalDigits.
  • The MV of StrUnsignedDecimalLiteral:::DecimalDigitsExponentPart is the MV of DecimalDigits times 10e, where e is the MV of ExponentPart.

一旦确定了字符串数字文字的精确 MV,它将被舍入为 Number 类型的值。 如果 MV 为 0,则舍入值为 +0,除非 String 数字文字中的第一个非空白空间代码点为 “ - ”,在这种情况下舍入值为 -0。 否则,舍入值必须是 MV 的 Number 值(在 6.1.6 中定义的意义上),除非文字包含 StrUnsignedDecimalLiteral,并且该文本具有多于 20 个有效数字,在这种情况下,Number 值可以是通过将第 20 个之后的每个有效数字替换为 0 数字而产生的文字的 MV 的数值或通过用 0 数字替换第 20 个之后的每个有效数字而产生的文字的 MV 的数值, 第 20 位数字。 如果数字不是 ExponentPart 的一部分,则数字是重要的。

  • it is not 0; or
  • there is a nonzero digit to its left and there is a nonzero digit, not in the ExponentPart, to its right.

results matching ""

    No results matching ""