For AI agents: the complete documentation index is available at /tc39-atlas/en/llms.txt, the full documentation bundle is available at /tc39-atlas/en/llms-full.txt, and this page is available as Markdown at /tc39-atlas/en/proposals/stage/unstaged/proposal-math-extensions.md.
  • English
  • Math Extensions ?

    Proposal details
    Proposal overview

    This proposal aims to add common mathematical functions (like degrees/radians conversion, scale, clamp) as built-in Math methods, since these functions are frequently implemented inconsistently in many JS libraries. It references implementations in Java, Python, Racket, and Rust.g., Math.map vs Math.scale) and polyfills available.

    Note

    The README below comes from the upstream repository and may contain outdated stage or status metadata. Use the proposal details above as the current source of truth.

    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

    Python

    Racket

    Rust

    Questions

    • Math.map
      • Is it...
        • Math.scale <-- this
        • Math.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).
    • Math.constrain
      • Is it...
        • Math.constrain
        • Math.clamp

    Polyfills