Inactive
Classification: API Change
Human Validated: KW
Title: Math Extensions
Authors: Rick Waldron
Withdrawn: no interested champions in February 2024
Last Presented: None
Stage Upgrades:
Stage 1: 2016-07-27
Stage 2: NA
Stage 2.7: NA
Stage 3: NA
Stage 4: NA
Last Commit: 2019-10-21
Topics: others numbers
Keywords: math arithmetic numeric
GitHub Link: https://github.com/rwaldron/proposal-math-extensions
GitHub Note Link: https://github.com/tc39/notes/blob/HEAD/meetings/2016-07/jul-26.md#9iie-math-extensions
Proposal Description:
Math
Extensions Proposal
Champion
Rick Waldron
Status
This proposal is currently stage 1 of the TC39 process.
Motivation
These functions exist in many, many JS libraries either hand rolled or via many modules on npm. Providing them as built-ins serves to pave cow path. Implementations and naming is inconsistent. Several other languages offer these as built-ins.
Java
- https://docs.oracle.com/javase/7/docs/api/java/lang/Math.html
Math
Math.toDegrees(double angrad)
Math.toRadians(double angdeg)
- JSR275
- JScience
Python
- Math
- https://docs.python.org/2/library/math.html#angular-conversion
- https://docs.python.org/3/library/math.html#angular-conversion
math
math.degrees(x)
math.radians(x)
- Units
Racket
- Math
- 4.2.2.10 Extra Constants and Functions
- Operations on Measures
- 1.1.1 Operations on Measures
Rust
Questions
Math.map
- Is it…
Math.scale
⇐ thisMath.map
Math.remap
- Should there be a corresponding
Math.fmap
? (ie. https://tc39.github.io/ecma262/#sec-math.fround, Step 3 & 4 convert result to IEEE 754-2008 binary32 (using roundTiesToEven), then to IEEE 754-2008 binary64).
- Is it…
Math.constrain
- Is it…
Math.constrain
Math.clamp
- Is it…
Polyfills
- Polyfill.
- Also, a polyfill is available in the core-js library. You can find it in the ECMAScript proposals section.