Whose maths is it?

JavaScript's spec lets most of Math vary, so each answer is a decision: an engine's, a build's, or a library's.

Curving lines emerging from from a single point on the left that converge and end at different ticks on the right.

The primer, What runs your JavaScript?, ended on the conform-but-still-disagree paradox: give JavaScript engines the same maths, and they won't all hand back the same answer, even though each one conforms. Here it is in the three browsers on my Mac:

Math.tan( 7 );
  • Chrome: 0.8714479827243188
  • Firefox: 0.8714479827243187
  • Safari: 0.8714479827243189

Same machine, same input, three answers, different in the last digit, and all three allowed.[1] Each comes from a different maths library: Chrome's from LLVM's, which V8 adopted for tan in 2026; Firefox's from fdlibm, the library the specification itself recommends; and Safari's from macOS's own C library.

The paradox resolves into a tradeoff. The specification promises conformance, not agreement, and for most of Math it describes an ideal answer without fixing the bits. Leaving room lets an engine use the maths library its platform already has, which is what the specification has said it wanted since 1997.[2] What it costs is answers that agree. This post is about that room: how old it is, which differences fall inside it and which don't, and whose decision each answer is.

Older than the spec

Platform dependence is older than the specification. JavaScript 1.0 shipped in Netscape Navigator 2.0 in March 1996, with 17 functions on Math. According to Allen Wirfs-Brock and Brendan Eich's history of the language, one of them, Math.random, was "available only on Unix platforms," and the number-parsing functions behaved differently "depending upon host operating system."[3]

The first edition of ECMA-262, in June 1997, had 18: the same 17, plus atan2. It left their answers to the implementation. The transcendental functions return "an implementation-dependent approximation," random uses "an implementation-dependent algorithm or strategy," and the specification says why: "an implementor 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." So from its first edition, the specification expected engines to use whatever maths the platform already had. It also recommended one library, fdlibm, "the freely distributable mathematical library from Sun Microsystems," as the third edition later described it. From the third edition on, that recommendation sits in a Note, which makes it informative rather than a rule.[2:1]

The idea got its current name in ES2021, which calls these functions implementation-approximated. The current edition defines that as a facility "defined in whole or in part by an external source but has a recommended, ideal behaviour in this specification." Implementations "are encouraged to strive to approximate the ideal," and that's all. Compare implementation-defined, which names no ideal at all.[4] ES1's own wording, "some latitude is allowed in the choice of approximation algorithms," is still there in 2026.[2:2]

In ECMAScript 2026, the current edition, Math has 37 functions, and they split three ways:[5]

  • Implementation-approximated, 22: trigonometry and its inverses; the hyperbolic functions and theirs; exp, expm1, and the logarithms; cbrt and hypot; and pow, which ** uses too.
  • Implementation-defined, 1: random.
  • Exact, 14: sign and size, rounding, and bit operations, plus sqrt (exact since ES2025) and sumPrecise (new in ES2026).

So what most people mean by maths—trigonometry, exponentials, logarithms, and powers—is all on the approximated side. Almost all of it, anyway: sqrt is maths in anyone's sense, and it's exact. And sumPrecise shows the specification can pin a result down when TC39, the committee that writes it, chooses to. It adds its numbers as if exactly and rounds once, at the end, so there's one right answer.[5:1] (As of November 2026, no stable Node.js release has it on by default.[6]) The split isn't something the specification can't help. It's a choice, made function by function.

A bar of the 37 Math functions in ES2026, split three ways: 22 implementation-approximated, 1 implementation-defined, and 14 exact. Below it, the functions in each group. Approximated: sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, asinh, acosh, atanh, exp, expm1, log, log1p, log2, log10, cbrt, hypot, and pow, with the ** operator. Implementation-defined: random. Exact: abs, sign, max, min, floor, ceil, round, trunc, fround, f16round, clz32, imul, sqrt since ES2025, and sumPrecise in ES2026.
Most of what people mean by maths is on the approximated side: trigonometry, exponentials, logarithms, and powers are each implementation's to answer. Source: ECMA-262, 17th edition, §21.3.2 and §4.4.1.

Two flat stretches

Math's count stayed flat twice, and for different reasons. It held at 18 from ES1 to ES5.1. After ES2015 added 17 functions, it held flat again at 35, until f16round arrived in ES2025 and sumPrecise in ES2026.[7]

The first flat stretch was the standard's own. After ES3, in December 1999, no edition came out for ten years. ES4 was worked on, and abandoned in July 2008, and ES5 followed in December 2009.[8] Wirfs-Brock and Eich call that stretch "Failed Reformations."

The second was Math's alone. From ES2016 to ES2024, an ECMAScript edition came out every June, and none added a function to Math. However, that's a lull in additions, not in attention: Math's own text changed in every one of those editions. In ES2020, as part of adding BigInt, pow was redefined on Number::exponentiate, the same operation ** uses. ES2021 gave these functions their term, implementation-approximated, and ES2022 required them to return a Number value. Just after the lull, in ES2025, sqrt became exact.[7:1]

A timeline from 1995 to 2026 of how many function properties Math has, with JavaScript 1.0 marked before ES1. In March 1996 Netscape 2.0 ships JavaScript 1.0 with 17 functions, marked by an open circle on the axis where the editions have solid ticks, with a dashed line up to a label: "JavaScript 1.0, Netscape 2.0, March 1996: 17 functions, before the standard". There's no step for it. ES1 to ES5.1 have 18, 17 plus atan2. ES2015 adds 17, for 35, and the count stays at 35 through nine editions, ES2016 to ES2024, marked as the lull. ES2025 has 36, adding f16round, and ES2026 has 37, adding sumPrecise. A tick marks each edition, with none for the ten years from ES3 in 1999 to ES5 in 2009, marked as no new edition, because ES4 was abandoned. Below the axis: in ES3, fdlibm's recommendation moves into a Note; in ES2021 the term "implementation-approximated" arrives; in ES2022 results must be Number values; and in ES2025 sqrt is made exact.
Nine editions, no new Math functions: from 2016 to 2024 an edition came out every year, and none added a function to Math, though its text was reworked, including the term "implementation-approximated" in 2021. The standard's own pause came earlier: ten years from ES3 in 1999 to ES5 in 2009, after ES4 was abandoned in 2008. Sources: Ecma's edition texts; Wirfs-Brock and Eich, "JavaScript: The First 20 Years" (2020).

Nor was it a lull in numbers. TC39's numeric work went around Math rather than into it: the ** operator in ES2016; BigInt, for integers of any size, in ES2020; and numeric separators, as in 1_000_000, in ES2021. Even the two functions that ended the lull began during it. f16round first came to TC39 in May 2017, as Math.hfround, and the notes from that meeting record "A polyfill exists, but not efficient." sumPrecise followed in November 2023.[9]

Libraries did the rest. For statistics there was jStat, "native javascript implementations of statistical functions"; and math.js, with an expression parser, units, and matrices. For numbers a double can't hold, there was decimal.js, "an arbitrary-precision Decimal type for JavaScript," and several others.[10] Some were built to be replaced. JSBI, from Google Chrome Labs, was a BigInt "polyfill" that "behaves exactly like the upcoming native BigInts," so code written with it could later be converted to the real thing mechanically. And BigInteger.js, another big-integer library, became "a thin wrapper over the native implementation" wherever an engine had one.[11]

What kind of difference?

Back inside Math, the three answers to Math.tan(7) are the specification's room at work. Not every difference is room, though; there are three kinds:

  • Spec room: two answers, both allowed.
  • Different aims: a project chose something else, and said so.
  • Plainly wrong: no aim explains it, and one check shows it.

The runs behind this post's examples were measured on macOS arm64, and on Linux VMs in Claude Code Cloud (x86_64) and OrbStack (aarch64).

Spec room

The three browsers' answers are this kind. So is the cleanest case, which involves one engine and one source file. MicroQuickJS, the engine for embedded systems from the primer, carries its own maths library, libm.c. Built from the same commit by GCC on Linux x86_64 and by Apple clang on macOS arm64, it gives different answers on nine Math functions.[12]

The algorithms are the same. The compilers aren't. Apple clang, by default, turns a * b + c into a fused multiply-add (FMA): one operation, rounded once instead of twice. GCC, building for baseline x86_64, has no FMA instruction to fuse into. Build MicroQuickJS on the Mac with fusing turned off, and it gives the Linux answers on all 17 functions tested.[12:1]

Here's Math.tan of one input, as the last few hexadecimal digits of each answer's 64 bits:

  • macOS: ...28e
  • Linux: ...28c
  • correctly rounded: ...28d

Correctly rounded means the true answer, rounded to the nearest double, the closest a 64-bit number can get to the specification's ideal. A ULP, a unit in the last place, is the gap between two neighboring doubles, so 1 ULP is the smallest difference two answers can have. The two builds are each 1 ULP off, on opposite sides. Neither build is wrong by the specification's terms.

One source file, MicroQuickJS's own libm.c, compiled two ways: by GCC 13.3.0 on Linux x86_64, which keeps a times b plus c as two roundings, and by Apple clang 21.0.0 on macOS arm64, which fuses them into one. Both compute Math.tan(-18.12626632161318), which is 0.88290488022137 and so on. On a number line of three neighboring doubles, Linux gives the one ending 614, the correctly rounded one ends 625, and macOS gives the one ending 636, each one ULP away on opposite sides. A note: Apple clang with fusing turned off gives the Linux bits on all 17 functions.
Same code, two answers, both allowed: the compiler's default, not the algorithm, puts each build one ULP from the correct value, on opposite sides. Each answer is labeled by its last decimal digits, not the hex digits of its bits. Source: MicroQuickJS's libm.c at 6d4d7eb, and GCC 13.3.0's and Clang 21.1.0's documentation for -ffp-contract; measured on Linux x86_64 and macOS arm64 (fma-contraction/).

That's the post's tradeoff in miniature. Compilers fuse by default wherever the target has the instruction, and on its own the fused operation is generally the more precise one; what it costs is answers that agree from one build to the next.[13]

V8 shows the same thing: from 15.4, the atan in d8, V8's own command-line shell, which comes from LLVM's library, differs between Linux and macOS, by the same mechanism.[14]

Different aims

Some differences are decisions, judged fairly only against the project's own stated goal.

goja and otto, both written in Go, build their Math on Go's math package, and with it they take Go's stated promise: "This package does not guarantee bit-identical results across architectures."[15] Go also has math/big, for arbitrary precision, which their Math isn't built on. That's a design decision, not a shortcoming.

Elk, the engine that "does not even have a standard library," has no Math at all.[16] For an engine built to sit inside firmware, that's a choice about what to carry, not a fault.

Plainly wrong

And some are bugs, by this post's judgement rather than the specification's, which sets an ideal with no tolerance. Each of these names the build it was seen on, and whether a newer release fixes it.

Here's one input to Math.sin, the one in Chromium bug 511271840:

Math.sin( 1.1986535513718587e+138 );

On a Mac (macOS on arm64), d8 13.6.233 and 14.6.202 both return 3.811845021115429e-16. The correctly rounded answer is 3.811845021115953e-16, and d8's is 1,063 ULP below it. Bit for bit, it's what sin gives for that input in glibc 2.39, the C library on most Linux distributions. Node.js 24.19.0 (V8 13.6), on the same Mac, gives the correctly rounded answer, and so does d8 15.8.32. So does Chrome 158 (V8 15.8): I ran it in my own browser's console on 18 November 2026.[17]

It's fixed: V8 15.0 moved sin and cos to a different library, and the commit that did it records that V8 had been using "a glibc-based implementation," with sin up to 1,063 ULP out.[18]

The other plainly wrong case has the happiest ending. Rhino is a JavaScript engine written in Java. On a 2.0.0 snapshot, at commit 7386aa0, Math.asinh(1e300) returns Infinity: a textbook formula, overflowing. Someone reported it, and the fix shipped in Rhino 1.9.2, whose release notes say "Fix inconsistencies in the "Math" object by backporting algorithms from V8." Rhino 1.9.2 agrees with Node.js 24.19.0 on all eight inputs.[19]

Wrong, reported, fixed, by borrowing another engine's maths.

Whose decision?

So whose maths is it? Each answer in this post is somebody's decision, made on a different axis and under different conditions. The specification leaves 22 of the 37 to implementations.[5:2] After that, the decisions belong to engines, builds, the libraries engines call, bindings, and browsers.

The engine: V8

V8 is the clearest case, because by default it draws its Math from four places, and they've changed with its version.[20]

  • Its own code, for most functions, in a file that opens "The following is adapted from fdlibm."[20:1]
  • A copy of glibc's code, for sin and cos, from V8 11.0 (late 2022) until 15.0: "a handful of files that are forked from glibc," in V8's own words. They're glibc's code apart from build glue, and d8's default sin and cos match them on every case tested.[20:2]
  • LLVM's maths library, from 15.0, in May 2026, for most functions, one family per commit, and more since. V8's stated aim for the move was "consistent math results around configs." The glibc copy was deleted in 15.2.[21]
  • The platform's C library, for pow, by a flag that's on by default. pow was never V8's own code, so 15.0 had nothing to move.[20:3]

So "V8's maths" has a date and a function name.

A grid of where V8's Math comes from, with time running left to right across three periods: to V8 10.9, 11.0 to 14.x, and from 15.0. In clang builds with the flag on, sin and cos come from V8's own ieee754 code, then from a copy of glibc's, then from LLVM's libm. In Node.js's gyp builds, sin and cos stay on ieee754, with no release on 15 yet. The rest, such as exp, log, and tan, are ieee754 until 15, then LLVM's libm, one family per commit. pow is the platform's pow throughout, so 15 had nothing to move.
"V8's maths" has a date and a function: read a row across to see one function's sources over time, or a column down to see one period's mix. Source: V8's source at 13.6.233.17, and the commits that moved its maths to LLVM's libm; measured in d8 and Node.js builds (v8-sources/).

The build

A word on the version numbers. A host, such as a browser or a runtime, has its own version, and carries a version of V8: Node.js 24.19.0 carries V8 13.6, and Chrome 158 carries V8 15.8. d8 is V8's own shell, so it's numbered as V8 itself. Hosts and V8 move on different schedules. Chrome takes a new V8 with each major release, while a Node.js major line keeps the V8 it started with, so on any given day, the same script in Node.js and in Chrome runs on different V8s. Within a line, Node.js patches its V8 rather than replacing it. Node.js 24.19.0 and 24.22.3 both carry V8 13.6.233.17, and only a suffix differs, -node.51 against -node.63, which counts the patches Node.js has applied on top.[22] (Those two give the same Math answers on every case tested.) So the Node.js version says more than the V8 number does. And the same V8 version can still give two answers, because a version number names the source code, not how it was built.

Take the 1,063-ULP sin from Chromium bug 511271840. d8 13.6.233 and Node.js 24.19.0 (V8 13.6) carry the same V8, run on the same Mac, and give different answers. The difference is how each was built.

  • A build switch. V8's own build configuration compiles the glibc copy in for clang builds, which is how d8 is built. Node.js builds V8 with a different build system, gyp, which leaves it out: Node.js 24.19.0 doesn't even accept the flag that turns it off.[20:4] By the same configuration, Chrome, a clang build, would have had the glibc sin before 15.0.
  • Runtime flags. Where the copy is compiled in, --use-libm-trig-functions chooses it at startup, and --use-std-math-pow chooses the platform's pow. Both are on by default. The trig flag existed only from 11.0 to 15.1.[20:5]
  • The compiler's defaults. Apple clang fuses multiply-adds where the hardware has the instruction, and GCC's default would too, but GCC, building for baseline x86_64, has no FMA instruction to fuse into. That's MicroQuickJS's tan pair.

Same engine version, same machine, same C library, and a different answer, from choices made when the engine was built or started.

The families

Many engines draw on somebody else's code, and sorted by whose, they fall into a few families. Engines that call the same library get the same answers from it, so one bug shows up in all of them, and one upstream fix fixes all of them.

The platform's C library. Operating systems ship a C library with maths functions in it: glibc, the default on most Linux distributions; musl, the default on Alpine Linux; macOS's own; and Microsoft's C runtime on Windows. In QuickJS-ng, a small embeddable engine from the primer, Math.sin returns C's sin, and that's the whole function.[23] On macOS, several engines match the system's C library bit for bit on every Math function. On Linux, the same engines give glibc's bits instead, or musl's for a QuickJS-ng build linked against it.[24] So one engine, at one version, can answer differently depending on the operating system under it.

fdlibm and its ports. The specification's own recommendation. V8's own code is an fdlibm port, and so is most of SpiderMonkey's, Firefox's engine. Java's StrictMath is specified by fdlibm's algorithms, "to help ensure portability."[25] And scriptc, the primer's compiler with no engine at run time, carries a C port of V8's maths code, and its Math matches Node.js 24.19.0's bit for bit on all 7,820 cases tested: no engine, and still V8's answers.[26] A port is a copy, though, so a fix upstream doesn't reach it by itself.

The language the engine is written in. The engines from the primer that are written in Go, Java, and Rust tend to take that language's maths too. goja and otto call Go's math, which is how the clearest shared bug in these runs travels: Go's log of the smallest positive double, 5e-324, is wrong on x86_64 and right on arm64, and goja and otto give exactly Go's answers on both. It was reported to Go in 2022 and is still open.[27] Rhino and GraalJS build on Java's Math, which is "not defined to return the bit-for-bit same results."[28] And "written in Rust" doesn't necessarily tell you whose maths is being used: Boa uses Rust's f64 methods, whose sin "varies by platform, Rust version, and can even differ within the same execution," and underneath, its bits are the C library's.[29]

Three families of where an engine's Math comes from, each drawn as a source with an arrow to the engines that use it. The C library, glossed "one bug reaches all of them, and one fix fixes all of them": the platform's C library (glibc, macOS's libm, musl) serves QuickJS-ng, Hermes, Boa, JavaScriptCore for all but pow, SpiderMonkey for pow and for sin, cos, and tan on Windows, and V8 for pow. fdlibm and its ports, glossed "the spec's own recommendation. A port is a copy, so a fix upstream doesn't reach it by itself": fdlibm serves V8's ieee754 and SpiderMonkey for all but pow, outside Windows. The language it's written in, glossed "so Go's bugs reach goja and otto together": Go's math serves goja and otto, and Java's Math serves Rhino and GraalJS. A note below: this is SpiderMonkey as Firefox sets it up, and Firefox itself wasn't run; jsvu's shell gives the C library's sin, cos, and tan.
Many engines, a handful of sources: engines that call the same library give the same answers, so engines group by where their maths comes from, not by name. Source: each engine's source, at the commits the footnotes cite; measured against each system's C library on macOS and Ubuntu 24.04 (engine-families/).

The binding

A binding embeds an engine in another language's programs, and it brings that engine's maths with it, not the language's. v8go runs JavaScript from Go on V8, and its Math is V8's, bit for bit.[30]

It also keeps the V8 it was built with. A fix to V8 reaches Chrome and Node.js on their own schedules, but not every copy of V8 embedded somewhere else. PyMiniRacer 0.14.1, for Python, released in February 2026, carries V8 14.4 with the trig flag on, and gives the 1,063-ULP sin. v8go's latest release, v0.9.0, carries V8 10.9, older than the glibc copy, and gives the correct one. So here the newer binding has the worse sin.[30:1]

The glibc copy was in V8 from 11.0, in November 2022, to 15.0, in May 2026. PyMiniRacer sits inside that window, v8go before it, and Chrome after it. Node.js sits inside it too, and still gives the correct value, because its gyp build leaves the copy out. Here's the same input, Math.sin(1.1986535513718587e+138), through three of those copies, on one Mac:[30:2]

Three copies of V8, one input: Math.sin(1.1986535513718587e+138) on one Mac, by the V8 each copy carries.
Copy V8 Its sin of the bug's input
v8go v0.9.0, latest release, 2023 10.9.194.9 correct
PyMiniRacer 0.14.1, for Python, 2026-02-01 14.4.258.23 1,063 ULP low; correct with the flag off
Chrome 158.0.8127.37, browser, run 2026-11-18 15.8.62.31 correct

The browser's settings

Mozilla gives Firefox two separate settings that choose SpiderMonkey's sin, cos, and tan. One is a preference, use_fdlibm_for_sin_cos_tan, on by default everywhere but Windows, where those three go to the C library instead, as they do in SpiderMonkey's own shell. Firefox's source doesn't say why Windows is the exception. That preference is why Firefox on a Mac gives fdlibm's answer to Math.tan(7); on Windows it would give the C library's. The other setting is Firefox's fingerprinting protection, which forces fdlibm per page on any platform. The source ties that one to privacy, though not in so many words. The reading is that the same bits for every user leave Math nothing to tell users apart by.[31]

So, the three answers to Math.tan(7). The code is LLVM's maths library in Chrome, fdlibm in Firefox, and macOS's C library in Safari. The decisions are V8's, Mozilla's, and JavaScriptCore's. V8's team adopted LLVM's library for tan in 15.0; Mozilla's preference gives fdlibm everywhere but Windows; and JavaScriptCore calls the platform's own library for every Math function but pow. Three pieces of code, and three decisions about which one to use.[24:1]

Why you might not care, and that's fine

Accurate repeatable numerical precision isn't the goal of a lot of JavaScript devs. Which is fine. For nearly everything JavaScript is used for, almost nobody will notice a difference in the last bit. Engines make reasonable tradeoffs for the work most people do with them, and maths that gives the same bits everywhere is a specific need, not a universal one, for the places where it matters.

Allowing Math functions to be implementation-approximated also allowed browser engines to choose performance over accuracy, especially when considering games and animations where exact answers are not always necessary, but maximizing frames per second is paramount. In 2013, V8 replaced its sin and cos with a lookup table. A Firefox bug the next year was titled "V8 is 2.8x faster at sin/cos," and the patch written in reply was, by its author's account, "a little less precise overall."[32]

Other languages give that need its own home, so most code doesn't pay for it. Java has StrictMath beside Math. JavaScript has only Math.

Platform dependence isn't only JavaScript's, either. NumPy's np.longdouble is whatever the C compiler's long double is: 80 bits on most x86 machines, but a plain double with Microsoft's compiler and with Apple's clang on arm64, so the same code gives different answers by platform. More precision is opt-in, through numpy-quaddtype.[33]

Who takes the job on

So the paradox was never a contradiction. The specification promises that each engine conforms, not that they agree, and for 22 of Math's 37 functions it describes the answer without fixing the bits. That room is what lets an engine use the maths its platform already has, and what it costs is answers that match from one machine, or one build, to the next.

Inside that room, every answer is somebody's decision. V8 decided which library each function comes from, and changed it in 2026. A build decided whether glibc's copy went in, and the compiler whether to fuse a multiply-add. Mozilla decided Firefox's sin, cos, and tan, platform by platform; a binding kept whatever V8 it was built with; and an engine that calls its platform's C library, or its own language's maths, takes that library's decisions, bugs included. Most of these are room, some are aims, and a few are bugs, two of them since fixed and Go's still open. For most code, none of it shows.

Where it does show, the specification can require a function's exact result, but it does that one function and one edition at a time. When Math stopped gaining functions, libraries filled the gap. Answers that don't move, from engine to engine, whatever each one borrows its maths from, are a gap of the same kind. So what would it take for a library's answers to hold still wherever it runs, without waiting for the specification to require them? That's the next post.


Mara Averick is a developer advocate at Quansight and contributor experience lead for stdlib.


stdlib is an open source software project dedicated to providing a comprehensive suite of robust, high-performance libraries to accelerate your project's development and give you peace of mind knowing that you're depending on expertly crafted, high-quality software.

If you've enjoyed this post, give us a star 🌟 on GitHub and consider supporting the project. Your contributions and continued support help ensure the project's long-term success and are greatly appreciated!

Acknowledgments

This work was supported in part by the National Science Foundation under Award No. 2449410.

Disclaimer: Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.


  1. Run on 18 November 2026, once in each browser's console, on one Mac with macOS 26.7.3, all three running as arm64: Chrome 158.0.8127.37 (V8 15.8.62.31), Firefox 160.0.1, and Safari 27.2 (21625.2.8.18.4). The bits are 3febe2e6e13eea79, 3febe2e6e13eea78, and 3febe2e6e13eea7a, three neighboring doubles; to see them yourself, paste this into a console: f=new Float64Array(1),u=new BigUint64Array(f.buffer),[Math.tan(4),Math.tan(7),Math.sin(18),Math.cos(29)].map(x=>(f[0]=x,u[0].toString(16))). Your versions will have moved on, and Firefox on Windows takes a different path, by its own preference. These runs, and the evidence behind the rest of this post, are in a companion repository, blog-whose-maths-is-it-1, in browsers/. ↩︎

  2. Ecma International, ECMA-262, 1st edition, June 1997 (PDF), and 3rd edition, December 1999 (PDF), both at §15.8.2. For the stated reason: the 1st edition leaves the behavior of ten Math functions open so that "an implementor 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," and the 17th edition keeps the sentence, spelled "implementer," in a Note to §21.3.2. For fdlibm: the 1st edition recommends it in its own text, "though it does not require" it, and the 3rd moves that recommendation into a Note and calls fdlibm "the freely distributable mathematical library from Sun Microsystems." For the "latitude" wording: unchanged in the 17th edition, §21.3.2. ↩︎ ↩︎ ↩︎

  3. Allen Wirfs-Brock and Brendan Eich, "JavaScript: The First 20 Years," Proceedings of the ACM on Programming Languages 4 (HOPL), article 77, 2020, doi:10.1145/3386327. Figure 8, page 77:19, footnote 1 on random, "In 1.0 available only on Unix platforms," and footnote 2 on parseFloat and parseInt, "In 1.0 behavior differs depending upon host operating system"; the March 1996 date is from appendix E.1, page 136 of the authors' corrected version. ↩︎

  4. ECMA-262, 17th edition. For implementation-approximated: §4.4.1 and §4.2, Hosts and Implementations; the term first appears in the 12th edition, ES2021, at §4.4.1. For implementation-defined: §4.4.2 and §4.2, which says of these "This specification does not make any recommendations for particular behaviours." ↩︎

  5. ECMA-262, 17th edition. For the split: §21.3.2, Function Properties of the Math Object, counted from each function's own steps: 22 functions return an implementation-approximated value, random is implementation-defined, and 14 are exact; pow is approximated through Number::exponentiate, which ** also uses; Math.sqrt is exact from the 16th edition, ES2025 (§21.3.2.33). For sumPrecise: §21.3.2.34, new in this edition, whose steps add each value's mathematical value, ℝ(n), and return 𝔽(sum), rounding once. ↩︎ ↩︎ ↩︎

  6. Node.js 26.13.1, the newest stable release, carries V8 14.6.202.34 and has no sumPrecise without a flag (run 18 November 2026); Node.js 26.7.0 has it behind --js-sum-precise (run 17 November 2026). The Node.js 27 alpha, 27.0.0-alpha.0.1.1 (archived), has it unflagged, run on 18 November 2026. ↩︎

  7. Counted in each edition's own text, as function properties of Math, since ES2015 also added Math[@@toStringTag], which isn't a function: ES2015's at §20.2.2, f16round in ES2025 at §21.3.2.18, and sumPrecise in ES2026 at §21.3.2.34. The lull's changes to Math's text, each with its tc39/ecma262 pull request: pow on Number::exponentiate in ES2020, §20.3.2.26 (#1515); the term in ES2021, §4.4.1 (#1951, #2122); the Number value in ES2022, §21.3.2 (#2523); and an exact sqrt in ES2025, §21.3.2.33 (#3345). ↩︎ ↩︎

  8. Allen Wirfs-Brock and Brendan Eich, "JavaScript: The First 20 Years," 2020, Part 3, "Failed Reformations," pages 52–75, and its timeline, appendix E.3; and Ecma International, ECMA-262, 3rd edition, December 1999 (PDF), and 5th edition, December 2009 (PDF). ↩︎

  9. Ecma International, ECMA-262: the ** operator in ES2016, §12.6, BigInt in ES2020, §6.1.6.2, and numeric separators in ES2021, §12.8.3. TC39's meeting notes for 23 May 2017, agenda item "Float16 on TypedArrays, DataView, Math.hfround for stage 1", and the line quoted; and for 28 November 2023, agenda item "Math.sum". ↩︎

  10. Each project's README, at the commit linked: jStat, math.js, and decimal.js. Others from the same years: Simple Statistics, "descriptive, regression, and inference statistics"; ndarray, "Modular multidimensional arrays for JavaScript"; Numeric Javascript, for "numerical analysis in the browser"; bn.js, for big integers; and bignumber.js and big.js, for arbitrary-precision decimals. All were picked as widely downloaded on npm during the lull, a rough guide to what people used. ↩︎

  11. JSBI's README, section "Why?", which links its Babel plugin for the conversion; and BigInteger.js's README, "Update (December 2, 2018)." ↩︎

  12. MicroQuickJS, libm.c at 6d4d7eb, built with GCC 13.3.0 on Ubuntu 24.04 (x86_64) and with Apple clang 21.0.0 on macOS arm64. The tan input is 0xc0322052fd59ea32; the answers are 3fec40c1bc40f28e (macOS), 3fec40c1bc40f28c (Linux), and 3fec40c1bc40f28d, the correctly rounded value, from MPFR. ↩︎ ↩︎

  13. GCC 13.3.0, -ffp-contract: "The default is -ffp-contract=fast," which forms fused multiply-adds "if the target has native support for them." Clang 21.1.0, -ffp-contract: on by default for C, and "Fused operations are permitted to produce more precise results than performing the same operations separately." ↩︎

  14. d8 15.4 and later call LLVM libc's atan, vendored into V8, which uses fused multiply-adds on arm64 and not on baseline x86_64. ↩︎

  15. Go, src/math/const.go at go1.26.10, and math/big. goja calls math.Sin at 622d100, and otto at v0.5.1. ↩︎

  16. Elk, README at 71a86fa. ↩︎

  17. For d8 and Node.js: run on 3 November 2026 on an Apple M1 Pro, macOS arm64: d8 13.6.233, 14.6.202, and 15.8.32, and Node.js 24.19.0 (V8 13.6.233.17), against a correctly rounded value from mpmath at 2,000 bits. d8's default value was a glibc bug with huge arguments, fixed in glibc 2.44 (bug 34376). For Chrome 158: Chrome 158.0.8127.37, Stable, arm64, on macOS 26.7.3, whose chrome://version reports V8 15.8.62.31, as Chromium Dash's Stable release record does, read 18 November 2026. Stable moves every few weeks. ↩︎

  18. V8 commit 57fb9f9, "[math] Move sin/cos back to src/base/iee75.cc" [sic], 18 May 2026. ↩︎

  19. Rhino's 1.9.2 release notes, at b3d405f. The fault was measured on the build the engine set was tested on, at 7386aa0, and 1.9.2 was run on arm64 only, on 3 November 2026. ↩︎

  20. V8 at 13.6.233.17, one file per claim, in reading order. For its own code, adapted from fdlibm: src/base/ieee754.cc. For the glibc copy: third_party/glibc/README.v8; the switch landed in 4588fe5 on 30 November 2022, in 11.0. For pow: math::pow and its --use-std-math-pow flag; after the specification's special cases and two shortcuts, it calls the platform's std::pow. For the build switch: gni/v8.gni sets v8_use_libm_trig_functions = is_clang; Node.js's gyp files at v24.19.0 don't mention it, and Node.js 24.19.0 rejects --no-use-libm-trig-functions as a bad option. For the runtime flags: the trig flag defaults to on in flag-definitions.h, as the pow flag does; the trig flag was removed in 15.2, in 8787f084. ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎

  21. V8's tracking bug, 510499297, states the aim. tan moved in cc1a6fc, 11 May 2026; tanh, sinh, and cosh followed in 15.9; and the glibc copy and its flag were removed in 8787f084, "Remove ability to call glibc sin/cos," 6 July 2026. ↩︎

  22. process.versions.v8 in the Node.js REPL, on a Mac, 18 November 2026: Node.js 24.19.0 reports 13.6.233.17-node.51, and 24.22.3 13.6.233.17-node.63, and the two gave identical bits on every case tested. Node.js's common.gypi says of the suffix "Increment by one for each non-official patch applied to deps/v8" (v24.19.0, v24.22.3). ↩︎

  23. QuickJS-ng, quickjs.c at v0.17.0, js_math_sin. ↩︎

  24. Measured on macOS against a C program calling the system's maths library directly: QuickJS-ng, Boa, Duktape, Hermes, and JerryScript match it on every Math function, and JavaScriptCore on all but pow; on Linux, against Ubuntu 24.04's glibc 2.39. JavaScriptCore calls std:: for every function but pow (MathCommon.h at 324323). ↩︎ ↩︎

  25. Oracle, java.lang.StrictMath, Java SE 25. SpiderMonkey, js/src/builtin/Math.cpp at 159.0b5, which uses fdlibm_* for every function but pow, and for sin, cos, and tan only when a Firefox preference says so. ↩︎

  26. scriptc 0.4.7, on Linux x86_64, against Node.js 24.19.0. Its runtime's port is scr_ieee754.c at 6c60b0b, with pow from the platform, built from those sources by its release workflow (run 41153019462). ↩︎

  27. golang/go issue 56600; its fix, CL 448216, hadn't landed as of 18 November 2026. Math.log(5e-324) is -709.0895657128241 on x86_64 (Go's amd64) and -744.4400719213812 on arm64, in goja, otto, and Go itself. ↩︎

  28. Oracle, java.lang.Math, Java SE 25. Rhino calls it in NativeMath.java at 7386aa0, and GraalJS in SinNode.java at 25.0.3. ↩︎

  29. Rust, f64, version 1.91.0. Boa, math/mod.rs at v0.22. ↩︎

  30. v8go, "Execute JavaScript from Go": v0.9.0 carries V8 10.9.194.9, and its pinned commit, 12b0374, from 2021, carries 9.0.257.18 and also gives the correct value. PyMiniRacer, "Minimal, modern embedded V8 for Python": 0.14.1, released 1 February 2026, carries V8 14.4.258.23. Node.js 24.19.0 (V8 13.6) and 26.13.1 (V8 14.6), the current release as of 17 November 2026, give the correct value inside the window, and both reject the trig flag. Run on one Mac, 17 November 2026; Chrome 158 on 18 November 2026. ↩︎ ↩︎ ↩︎

  31. Firefox at 159.0b5: the preference javascript.options.use_fdlibm_for_sin_cos_tan, whose comment names privacy.resistFingerprinting, and the per-document setting from fingerprinting protection, in nsGlobalWindowOuter.cpp; the preference is the same in Firefox 160.0.1, which ran the Math.tan(7) snippet (its release commit). How the fingerprinting setting reaches the engine was read from names and comments, not traced. ↩︎

  32. V8 commit e83fd01, "Implement Math.sin, cos and tan using table lookup and spline interpolation," 12 November 2013, relanding r17594 from 8 November; the fdlibm port that replaced it is 7185729, 6 August 2014. Mozilla, bug 967709, "V8 is 2.8x faster at sin/cos," opened 4 February 2014: comment 3, on V8's version, "Not particularly precise -- up to 4 erroneus [sic] bits"; and comment 12 for the patch, "a little less precise overall," which its author called "an acceptable tradeoff here." ↩︎

  33. NumPy, basics.types.rst, "Extended precision," at f7fdace6; and Quansight Labs, "Numpy QuadDType: Quadruple Precision for Everyone", 30 September 2024. Apple's clang on arm64 was checked on 18 November 2026: sizeof(long double) is 8. ↩︎