This is the formal specification for a proposed extension
of the Math
JavaScript
This section augments the original Numeric Types clause.
ECMAScript has two built-in numeric types: Number and BigInt. In this specification, every numeric type T contains a multiplicative identity value denoted T::unit. The specification types also have the following
Invocation Synopsis | Example source | Invoked by the Evaluation semantics of ... | Result |
---|---|---|---|
T:: |
Math.abs(x)
|
T | |
T::exponentiate(x) |
Math.sign(x)
|
T | |
T::sign(x) |
Math.sign(x)
|
T | |
T::sqrt(x) |
Math.sqrt(x)
|
T |
The abstract operation Number::abs takes argument x (a Number). It performs the following steps when called:
The abstract operation Number::sign takes argument x (a Number). It performs the following steps when called:
The abstract operation Number::sqrt takes argument x (a Number). It performs the following steps when called:
The abstract operation BigInt::abs takes argument x (a BigInt). It performs the following steps when called:
The abstract operation BigInt::sign takes argument x (a BigInt). It performs the following steps when called:
The abstract operation BigInt::sqrt takes argument x (a BigInt). It performs the following steps when called:
This section augments the original Function Properties of the Math Object clause.
Returns the absolute value of x; the result has the same magnitude as x but has positive sign.
When the Math.abs
method is called with argument x, the following steps are taken:
Given zero or more arguments, calls
When the Math.max
method is called with zero or more arguments which form the rest parameter ...args, the following steps are taken:
The comparison of values to determine the largest value is done using the IsLessThan algorithm except that
The max
method is
Given zero or more arguments, calls
When the Math.min
method is called with zero or more arguments which form the rest parameter ...args, the following steps are taken:
The comparison of values to determine the largest value is done using the IsLessThan algorithm except that
The min
method is
When the Math.pow
method is called with arguments base and exponent, the following steps are taken:
Returns the sign of x, indicating whether x is positive, negative, or zero.
When the Math.sign
method is called with argument x, the following steps are taken:
Returns the square root of x.
When the Math.sqrt
method is called with argument x, the following steps are taken: