?um/p1-90`The Number
extends clause of a class definition. Subclass super call to the Number This function performs the following steps when called:
The Number
The value of Number.EPSILON is the
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function differs from the global isNaN function (
An
This function performs the following steps when called:
Due to rounding behaviour necessitated by precision limitations of Number.MAX_SAFE_INTEGER is shared with at least one other 9007199254740992 and 9007199254740993 evaluate to the Number value
The value of Number.MAX_SAFE_INTEGER is
This property has the attributes { [[Writable]]:
The value of Number.MAX_VALUE is the largest positive
This property has the attributes { [[Writable]]:
Due to rounding behaviour necessitated by precision limitations of Number.MIN_SAFE_INTEGER is shared with at least one other -9007199254740992 and -9007199254740993 evaluate to the Number value
The value of Number.MIN_SAFE_INTEGER is
This property has the attributes { [[Writable]]:
The value of Number.MIN_VALUE is the smallest positive value of the
In the Number.MIN_VALUE must be the smallest non-zero positive value that can actually be represented by the implementation.
This property has the attributes { [[Writable]]:
The value of Number.NaN is
This property has the attributes { [[Writable]]:
The value of Number.NEGATIVE_INFINITY is
This property has the attributes { [[Writable]]:
The initial value of the
The initial value of the
The value of Number.POSITIVE_INFINITY is
This property has the attributes { [[Writable]]:
The initial value of Number.prototype is the
This property has the attributes { [[Writable]]:
The Number prototype object:
Unless explicitly stated otherwise, the methods of the Number prototype object defined below are not generic and the
The phrase โthis Number valueโ within the specification of a method refers to the result returned by calling the abstract operation
The initial value of Number.prototype.constructor is
This method returns a String containing this Number value represented in decimal exponential notation with one digit before the significand's decimal point and fractionDigits digits after the significand's decimal point. If fractionDigits is
It performs the following steps when called:
For implementations that provide more accurate conversions than required by the rules above, it is recommended that the following alternative version of step
This method returns a String containing this Number value represented in decimal fixed-point notation with fractionDigits digits after the decimal point. If fractionDigits is
It performs the following steps when called:
The output of toFixed may be more precise than toString for some values because toString only prints enough significant digits to distinguish the number from adjacent Number values. For example,
(1000000000000000128).toString() returns
(1000000000000000128).toFixed(0) returns
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement this method as specified in the ECMA-402 specification. If an ECMAScript implementation does not include the ECMA-402 API the following specification of this method is used:
This method produces a String value that represents this Number value formatted according to the conventions of the toString.
The meanings of the optional parameters to this method are defined in the ECMA-402 specification; implementations that do not include ECMA-402 support must not use those parameter positions for anything else.
This method returns a String containing this Number value represented either in decimal exponential notation with one digit before the significand's decimal point and
It performs the following steps when called:
The optional radix should be an
This method performs the following steps when called:
This method is not generic; it throws a
The
The abstract operation ThisNumberValue takes argument value (an
Number instances are
The BigInt
new operator or to be subclassed. It may be used as the value of an extends clause of a class definition but a super call to the BigInt This function performs the following steps when called:
The abstract operation NumberToBigInt takes argument number (a Number) and returns either a
The BigInt
This function performs the following steps when called:
This function performs the following steps when called:
The initial value of BigInt.prototype is the
This property has the attributes { [[Writable]]:
The BigInt prototype object:
The phrase โthis BigInt valueโ within the specification of a method refers to the result returned by calling the abstract operation
The initial value of BigInt.prototype.constructor is
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement this method as specified in the ECMA-402 specification. If an ECMAScript implementation does not include the ECMA-402 API the following specification of this method is used:
This method produces a String value that represents this BigInt value formatted according to the conventions of the toString.
The meanings of the optional parameters to this method are defined in the ECMA-402 specification; implementations that do not include ECMA-402 support must not use those parameter positions for anything else.
The optional radix should be an
This method performs the following steps when called:
This method is not generic; it throws a
The abstract operation ThisBigIntValue takes argument value (an
The initial value of the
This property has the attributes { [[Writable]]:
BigInt instances are
The Math object:
new operator.In this specification, the phrase โthe
The
This property has the attributes { [[Writable]]:
The
This property has the attributes { [[Writable]]:
The
This property has the attributes { [[Writable]]:
The
This property has the attributes { [[Writable]]:
The value of Math.LOG10E is approximately the reciprocal of the value of Math.LN10.
The
This property has the attributes { [[Writable]]:
The value of Math.LOG2E is approximately the reciprocal of the value of Math.LN2.
The
This property has the attributes { [[Writable]]:
The
This property has the attributes { [[Writable]]:
The value of Math.SQRT1_2 is approximately the reciprocal of the value of Math.SQRT2.
The
This property has the attributes { [[Writable]]:
The initial value of the
This property has the attributes { [[Writable]]:
The behaviour of the functions acos, acosh, asin, asinh, atan, atanh, atan2, cbrt, cos, cosh, exp, expm1, hypot, log, log1p, log2, log10, pow, random, sin, sinh, tan, and tanh is not precisely specified here except to require specific results for certain argument values that represent boundary cases of interest. For other argument values, these functions are intended to compute approximations to the results of familiar mathematical functions, but some latitude is allowed in the choice of approximation algorithms. The general intent is that an implementer should be able to use the same mathematical library for ECMAScript on a given hardware platform that is available to C programmers on that platform.
Although the choice of algorithms is left to the implementation, it is recommended (but not specified by this standard) that implementations use the approximation algorithms for fdlibm, the freely distributable mathematical library from Sun Microsystems (http://www.netlib.org/fdlibm).
This function returns the absolute value of x; the result has the same magnitude as x but has positive sign.
It performs the following steps when called:
This function returns the inverse cosine of x. The result is expressed in radians and is in the
It performs the following steps when called:
This function returns the inverse hyperbolic cosine of x.
It performs the following steps when called:
This function returns the inverse sine of x. The result is expressed in radians and is in the
It performs the following steps when called:
This function returns the inverse hyperbolic sine of x.
It performs the following steps when called:
This function returns the inverse tangent of x. The result is expressed in radians and is in the
It performs the following steps when called:
This function returns the inverse hyperbolic tangent of x.
It performs the following steps when called:
This function returns the inverse tangent of the quotient
It performs the following steps when called:
This function returns the cube root of x.
It performs the following steps when called:
This function returns the smallest (closest to -โ)
It performs the following steps when called:
The value of Math.ceil(x) is the same as the value of -Math.floor(-x).
This function performs the following steps when called:
If n is either
This function returns the cosine of x. The argument is expressed in radians.
It performs the following steps when called:
This function returns the hyperbolic cosine of x.
It performs the following steps when called:
The value of Math.cosh(x) is the same as the value of (Math.exp(x) + Math.exp(-x)) / 2.
This function returns the exponential function of x (e raised to the power of x, where e is the base of the natural logarithms).
It performs the following steps when called:
This function returns the result of subtracting 1 from the exponential function of x (e raised to the power of x, where e is the base of the natural logarithms). The result is computed in a way that is accurate even when the value of x is close to 0.
It performs the following steps when called:
This function returns the greatest (closest to +โ)
It performs the following steps when called:
The value of Math.floor(x) is the same as the value of -Math.ceil(-x).
This function performs the following steps when called:
This function performs the following steps when called:
This operation is not the same as casting to binary32 and then to binary16 because of the possibility of double-rounding: consider the number k =
Not all platforms provide native support for casting from binary64 to binary16. There are various libraries which can provide this, including the MIT-licensed half library. Alternatively, it is possible to first cast from binary64 to binary32 under roundTiesToEven and then check whether the result could lead to incorrect double-rounding. Such cases can be handled explicitly by adjusting the mantissa of the binary32 value so that it is the value which would be produced by performing the initial cast under roundTiesToOdd. Casting the adjusted value to binary16 under roundTiesToEven then produces the correct value.
Given zero or more arguments, this function returns the square root of the sum of squares of its arguments.
It performs the following steps when called:
The
Implementations should take care to avoid the loss of precision from overflows and underflows that are prone to occur in naive implementations when this function is called with two or more arguments.
This function performs the following steps when called:
This function returns the natural logarithm of x.
It performs the following steps when called:
This function returns the natural logarithm of 1 + x. The result is computed in a way that is accurate even when the value of x is close to zero.
It performs the following steps when called:
This function returns the base 10 logarithm of x.
It performs the following steps when called:
This function returns the base 2 logarithm of x.
It performs the following steps when called:
Given zero or more arguments, this function calls
It performs the following steps when called:
The comparison of values to determine the largest value is done using the
The
Given zero or more arguments, this function calls
It performs the following steps when called:
The comparison of values to determine the largest value is done using the
The
This function performs the following steps when called:
This function returns a Number value with positive sign, greater than or equal to
Each Math.random function created for distinct
This function returns the Number value that is closest to x and is integral. If two
It performs the following steps when called:
Math.round(3.5) returns 4, but Math.round(-3.5) returns -3.
The value of Math.round(x) is not always the same as the value of Math.floor(x + 0.5). When x is x is less than Math.round(x) returns Math.floor(x + 0.5) returns Math.round(x) may also differ from the value of Math.floor(x + 0.5)because of internal rounding when computing x + 0.5.
This function returns the sign of x, indicating whether x is positive, negative, or zero.
It performs the following steps when called:
This function returns the sine of x. The argument is expressed in radians.
It performs the following steps when called:
This function returns the hyperbolic sine of x.
It performs the following steps when called:
The value of Math.sinh(x) is the same as the value of (Math.exp(x) - Math.exp(-x)) / 2.
This function returns the square root of x.
It performs the following steps when called:
Given an
It performs the following steps when called:
The value of sum can be computed without arbitrary-precision arithmetic by a variety of algorithms. One such is the "Grow-Expansion" algorithm given in Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates by Jonathan Richard Shewchuk. A more recent algorithm is given in "Fast exact summation using small and large superaccumulators", code for which is available at https://gitlab.com/radfordneal/xsum.
This function returns the tangent of x. The argument is expressed in radians.
It performs the following steps when called:
This function returns the hyperbolic tangent of x.
It performs the following steps when called:
The value of Math.tanh(x) is the same as the value of (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x)).
This function returns the integral part of the number x, removing any fractional digits. If x is already integral, the result is x.
It performs the following steps when called: