Stage 1 Draft / July 28, 2016
Math Extensions
1Well-Known Intrinsic Objects#
Additions
Table 1: Well-known Intrinsic Objects
Intrinsic Name
|
Global Name
|
ECMAScript Language Association
|
%Math_max%
|
Math.max
|
The Math.max function (
20.2.2.24)
|
%Math_min%
|
Math.min
|
The Math.min function (
20.2.2.25)
|
2Math.clamp ( x, lower, upper )#
When the clamp
function is called, the following steps are taken:
- If any argument is
NaN, return
NaN.
- Let max be %Math_max%(x, lower).
- Let min be %Math_min%(max, upper).
- Return min.
3Math.scale ( x, inLow, inHigh, outLow, outHigh )#
When the scale
function is called, the following steps are taken:
- If any argument is
NaN, return
NaN.
- If x is one of
+∞,
-∞, return x.
- Return (x − inLow) × (outHigh − outLow) ÷ (inHigh − inLow) + outLow.
4Math.radians ( degrees )#
When the radians
function is called, the following steps are taken:
- If degrees is one of
NaN,
+∞,
-∞, return degrees.
- Let radians be (degrees ×
Math.DEG_PER_RAD
).
- Return radians.
5Math.degrees ( radians )#
When the degrees
function is called, the following steps are taken:
- If radians is one of
NaN,
+∞,
-∞, return radians.
- Let degrees be (radians ×
Math.RAD_PER_DEG
).
- Return degrees.
6Math.RAD_PER_DEG#
The Number value of Math.RAD_PER_DEG
is approximately 57.29577951308232.
180
|
= 57.29577951308232
|
π
|
This property has the attributes { [[Writable]]:
false, [[Enumerable]]:
false, [[Configurable]]:
false }.
7Math.DEG_PER_RAD#
The Number value of Math.DEG_PER_RAD
is approximately 0.0174532925199432.
π
|
= 0.0174532925199432
|
180
|
This property has the attributes { [[Writable]]:
false, [[Enumerable]]:
false, [[Configurable]]:
false }.