# Whose maths is it?

The primer, [*What runs your JavaScript?*](https://blog.stdlib.io/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:

```javascript
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](https://libc.llvm.org/), which V8 adopted for `tan` in 2026; Firefox's from [fdlibm](https://www.netlib.org/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\]

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\]

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\] (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.](https://blog.stdlib.io/content/images/2026/11/post2-figure-1-spec-kinds-tall@3x.png align="center")

### 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\]

![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.](https://blog.stdlib.io/content/images/2026/11/post2-figure-2-lull-option-k@2x.png align="center")

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\]

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.](https://blog.stdlib.io/content/images/2026/11/post2-figure-6-one-source-two-compilers-tall@3x.png align="center")

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](https://github.com/robertkrimen/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](https://issues.chromium.org/issues/511271840):

```javascript
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](https://www.gnu.org/software/libc/) 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](https://github.com/mozilla/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](https://github.com/mozilla/rhino/issues/2520), and [the fix](https://github.com/mozilla/rhino/pull/2522) 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\] 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\]
- **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\]
- **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\]

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.](https://blog.stdlib.io/content/images/2026/11/post2-figure-3-v8-periods-tall@3x.png align="center")

### 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\] 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\]
- **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](https://musl.libc.org/), 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](https://github.com/golang/go/issues/56600) 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.](https://blog.stdlib.io/content/images/2026/11/post2-figure-4-option-a@3x.png align="center")

### 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](https://github.com/bpcreech/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\]

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\]

| 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\]

## 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.

## Notes

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`](https://github.com/stdlib-js/blog-whose-maths-is-it-1), in [`browsers/`](https://github.com/stdlib-js/blog-whose-maths-is-it-1/tree/1.0.0/browsers).
2. Ecma International, [*ECMA-262, 1st edition*](https://ecma-international.org/wp-content/uploads/ECMA-262_1st_edition_june_1997.pdf), June 1997 (PDF), and [*3rd edition*](https://ecma-international.org/wp-content/uploads/ECMA-262_3rd_edition_december_1999.pdf), 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](https://262.ecma-international.org/17.0/index.html#sec-function-properties-of-the-math-object). 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](https://doi.org/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](https://zenodo.org/records/4960086).
4. ECMA-262, 17th edition. For implementation-approximated: [§4.4.1](https://262.ecma-international.org/17.0/index.html#sec-terms-and-definitions-implementation-approximated) and [§4.2, Hosts and Implementations](https://262.ecma-international.org/17.0/index.html#implementation-approximated); the term first appears in the 12th edition, ES2021, at [§4.4.1](https://262.ecma-international.org/12.0/#sec-terms-and-definitions-implementation-approximated). For implementation-defined: [§4.4.2](https://262.ecma-international.org/17.0/index.html#sec-terms-and-definitions-implementation-defined) and [§4.2](https://262.ecma-international.org/17.0/index.html#sec-hosts-and-implementations), 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](https://262.ecma-international.org/17.0/index.html#sec-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`](https://262.ecma-international.org/17.0/index.html#sec-numeric-types-number-exponentiate), which `**` also uses; `Math.sqrt` is exact from the 16th edition, ES2025 ([§21.3.2.33](https://262.ecma-international.org/16.0/#sec-math.sqrt)). For `sumPrecise`: [§21.3.2.34](https://262.ecma-international.org/17.0/index.html#sec-math.sumprecise), 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](https://github.com/nodejs/node/blob/e9c277643b0249c50f6e6de5413be8a88ea11b6a/deps/v8/include/v8-version.h) 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](https://github.com/nodejs/node/releases/tag/v27.0.0-alpha.0.1.1) ([archived](https://archive.is/6X3Ed)), 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](https://262.ecma-international.org/6.0/#sec-function-properties-of-the-math-object), `f16round` in ES2025 at [§21.3.2.18](https://262.ecma-international.org/16.0/#sec-math.f16round), and `sumPrecise` in ES2026 at [§21.3.2.34](https://262.ecma-international.org/17.0/index.html#sec-math.sumprecise). 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](https://262.ecma-international.org/11.0/#sec-math.pow) ([#1515](https://github.com/tc39/ecma262/pull/1515)); the term in [ES2021, §4.4.1](https://262.ecma-international.org/12.0/#sec-terms-and-definitions-implementation-approximated) ([#1951](https://github.com/tc39/ecma262/pull/1951), [#2122](https://github.com/tc39/ecma262/pull/2122)); the Number value in [ES2022, §21.3.2](https://262.ecma-international.org/13.0/#sec-function-properties-of-the-math-object) ([#2523](https://github.com/tc39/ecma262/pull/2523)); and an exact `sqrt` in [ES2025, §21.3.2.33](https://262.ecma-international.org/16.0/#sec-math.sqrt) ([#3345](https://github.com/tc39/ecma262/pull/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*](https://ecma-international.org/wp-content/uploads/ECMA-262_3rd_edition_december_1999.pdf), December 1999 (PDF), and [*5th edition*](https://ecma-international.org/wp-content/uploads/ECMA-262_5th_edition_december_2009.pdf), December 2009 (PDF).
9. Ecma International, ECMA-262: the `**` operator in [ES2016, §12.6](https://262.ecma-international.org/7.0/#sec-exp-operator), BigInt in [ES2020, §6.1.6.2](https://262.ecma-international.org/11.0/#sec-ecmascript-language-types-bigint-type), and numeric separators in [ES2021, §12.8.3](https://262.ecma-international.org/12.0/#sec-literals-numeric-literals). TC39's meeting notes for 23 May 2017, agenda item ["Float16 on TypedArrays, DataView, Math.hfround for stage 1"](https://github.com/tc39/notes/blob/53a59ad71704e669d488a6b67baf940bfe2fe134/meetings/2017-05/may-23.md?plain=1#L404), and [the line quoted](https://github.com/tc39/notes/blob/53a59ad71704e669d488a6b67baf940bfe2fe134/meetings/2017-05/may-23.md?plain=1#L425); and for 28 November 2023, agenda item ["Math.sum"](https://github.com/tc39/notes/blob/53a59ad71704e669d488a6b67baf940bfe2fe134/meetings/2023-11/november-28.md?plain=1#L386).
10. Each project's README, at the commit linked: [jStat](https://github.com/jstat/jstat/tree/72f367f6dbd45c2d903053ee3f9981489912cad4), [math.js](https://github.com/josdejong/mathjs/tree/1847c3344a0a63ad4bd5b2f2b97e7f4f05f32566), and [decimal.js](https://github.com/MikeMcl/decimal.js/tree/b1d1e311eb272b16f5b2ca0e0d1f4c4fa8558edf). Others from the same years: [Simple Statistics](https://github.com/simple-statistics/simple-statistics/tree/551ad9eebea7daa85f145f2cf8fe5e70b847aeb4), "descriptive, regression, and inference statistics"; [ndarray](https://github.com/scijs/ndarray/tree/b735a1472293b0290817225506569866a07bfbf6), "Modular multidimensional arrays for JavaScript"; [Numeric Javascript](https://github.com/sloisel/numeric/tree/656fa1254be540f428710738ca9c1539625777f1), for "numerical analysis in the browser"; [bn.js](https://github.com/indutny/bn.js/tree/eb2e57c4e50a9b9a1f277a59ef446c13f564dddc), for big integers; and [bignumber.js](https://github.com/MikeMcl/bignumber.js/tree/02109ca2749538d57551cdcc7e38585db111b4bb) and [big.js](https://github.com/MikeMcl/big.js/tree/cdbc06f1d5ae9be429b97f433ee884cf9ad28072), for arbitrary-precision decimals. All were picked as widely downloaded on npm during the lull, a rough guide to what people used.
11. [JSBI](https://github.com/GoogleChromeLabs/jsbi/tree/5382367c7e3199858d36bb620977e1f90605bcb9)'s README, section "Why?", which links its Babel plugin for the conversion; and [BigInteger.js](https://github.com/peterolson/BigInteger.js/tree/441f6bd73cef6a5029dd5600f17e3dd79eafeddb)'s README, "Update (December 2, 2018)."
12. MicroQuickJS, [`libm.c` at `6d4d7eb`](https://github.com/bellard/mquickjs/blob/6d4d7eb6b99011d5aab6e88a9b99e8fd4d86c6e9/libm.c), 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`](https://gcc.gnu.org/onlinedocs/gcc-13.3.0/gcc/Optimize-Options.html#index-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`](https://releases.llvm.org/21.1.0/tools/clang/docs/UsersManual.html#cmdoption-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](https://github.com/golang/go/blob/go1.26.10/src/math/const.go#L7), and [`math/big`](https://pkg.go.dev/math/big@go1.26.10). goja calls `math.Sin` at [`622d100`](https://github.com/dop251/goja/blob/622d10077b6c154d9dc0897878aa1b4a674d7c9b/builtin_math.go#L262), and otto at [v0.5.1](https://github.com/robertkrimen/otto/blob/43d0d581930e54a0daee9e3770b68e947a7f33fc/builtin_math.go#L185).
16. Elk, [README at `71a86fa`](https://github.com/cesanta/elk/blob/71a86fa2fef146696be9ae66715bf3f91d0a5f2c/README.md).
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](https://sourceware.org/bugzilla/show_bug.cgi?id=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](https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Mac&num=1) does, read 18 November 2026. Stable moves every few weeks.
18. V8 commit [`57fb9f9`](https://github.com/v8/v8/commit/57fb9f9a61646a038f69da56a318a97a122a986c), "\[math\] Move sin/cos back to src/base/iee75.cc" \[sic\], 18 May 2026.
19. Rhino's [1.9.2 release notes](https://github.com/mozilla/rhino/releases/tag/Rhino1_9_2_Release), at [`b3d405f`](https://github.com/mozilla/rhino/commit/b3d405fe2ef4948929629b23d85ba7eef76a2c2a). The fault was measured on the build the engine set was tested on, at [`7386aa0`](https://github.com/mozilla/rhino/commit/7386aa037d9a8020e4e69cc0af11eb73fe59d09d), 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`](https://github.com/v8/v8/blob/b0a55a7dad7f536cce1f9aaddba89894c8533946/src/base/ieee754.cc#L1). For the glibc copy: [`third_party/glibc/README.v8`](https://github.com/v8/v8/blob/b0a55a7dad7f536cce1f9aaddba89894c8533946/third_party/glibc/README.v8); the switch landed in [`4588fe5`](https://github.com/v8/v8/commit/4588fe544f78784f5d3a8861886cd4d73f20ab1e) on 30 November 2022, in 11.0. For `pow`: [`math::pow`](https://github.com/v8/v8/blob/b0a55a7dad7f536cce1f9aaddba89894c8533946/src/numbers/ieee754.cc#L14-L51) and its [`--use-std-math-pow` flag](https://github.com/v8/v8/blob/b0a55a7dad7f536cce1f9aaddba89894c8533946/src/flags/flag-definitions.h#L1029-L1030); after the specification's special cases and two shortcuts, it calls the platform's `std::pow`. For the build switch: [`gni/v8.gni`](https://github.com/v8/v8/blob/b0a55a7dad7f536cce1f9aaddba89894c8533946/gni/v8.gni#L169) 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`](https://github.com/v8/v8/blob/b0a55a7dad7f536cce1f9aaddba89894c8533946/src/flags/flag-definitions.h#L3488-L3490), as the `pow` flag does; the trig flag was removed in 15.2, in [`8787f084`](https://github.com/v8/v8/commit/8787f0842a158b0be8de8b4ae9b1d2f89a40d8ab).
21. V8's tracking bug, [510499297](https://issues.chromium.org/issues/510499297), states the aim. `tan` moved in [`cc1a6fc`](https://github.com/v8/v8/commit/cc1a6fcbdabbe4c912948bebe29371c084eade33), 11 May 2026; `tanh`, `sinh`, and `cosh` followed in 15.9; and the glibc copy and its flag were removed in [`8787f084`](https://github.com/v8/v8/commit/8787f0842a158b0be8de8b4ae9b1d2f89a40d8ab), "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](https://github.com/nodejs/node/blob/cdc1b38d40cb567b7ad0b39c86addf830a0af0ae/common.gypi#L42-L44), [v24.22.3](https://github.com/nodejs/node/blob/e63cab040c09d43ceef8cb35508c40044614e906/common.gypi#L43-L45)).
23. QuickJS-ng, [`quickjs.c` at v0.17.0](https://github.com/quickjs-ng/quickjs/blob/6d46d07d04041b40f4f49eaa7fdebe44c314c699/quickjs.c#L49054-L49064), `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](https://github.com/WebKit/WebKit/blob/19edf5893a3909a615e099e3a4b5ea88ada18c9c/Source/JavaScriptCore/runtime/MathCommon.h#L261-L287)).
25. Oracle, [`java.lang.StrictMath`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/StrictMath.html), Java SE 25. SpiderMonkey, [`js/src/builtin/Math.cpp` at 159.0b5](https://github.com/mozilla-firefox/firefox/blob/34ac0671eb25f31f8c56ace36e1c413dd471eb8d/js/src/builtin/Math.cpp), 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](https://github.com/vercel-labs/scriptc/releases/tag/v0.4.7), on Linux x86_64, against Node.js 24.19.0. Its runtime's port is [`scr_ieee754.c` at `6c60b0b`](https://github.com/vercel-labs/scriptc/blob/6c60b0bcbfc6edd34ce5c1cdb588d42bdb7171ff/packages/runtime/src/scr_ieee754.c), with `pow` from the platform, built from those sources by its release workflow ([run 41153019462](https://github.com/vercel-labs/scriptc/actions/runs/41153019462)).
27. [golang/go issue 56600](https://github.com/golang/go/issues/56600); its fix, [CL 448216](https://go.dev/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`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Math.html), Java SE 25. Rhino calls it in [`NativeMath.java` at `7386aa0`](https://github.com/mozilla/rhino/blob/7386aa037d9a8020e4e69cc0af11eb73fe59d09d/rhino/src/main/java/org/mozilla/javascript/NativeMath.java#L588), and GraalJS in [`SinNode.java` at 25.0.3](https://github.com/oracle/graaljs/blob/eba5be12437ddf85b56b6d50180ce93e6769f72b/graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/builtins/math/SinNode.java).
29. Rust, [`f64`](https://doc.rust-lang.org/1.91.0/std/primitive.f64.html), version 1.91.0. Boa, [`math/mod.rs` at v0.22](https://github.com/boa-dev/boa/blob/337a3668a0dc86dd401ea20906e782249a64a228/core/engine/src/builtins/math/mod.rs#L853).
30. v8go, ["Execute JavaScript from Go"](https://github.com/rogchap/v8go/tree/12b0374faffcc6a93eb284808ca1beab58259e72): 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"](https://github.com/bpcreech/PyMiniRacer/tree/95b89887e74103a91747bca45a1e35ff0e1b81c3): 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`](https://github.com/mozilla-firefox/firefox/blob/34ac0671eb25f31f8c56ace36e1c413dd471eb8d/modules/libpref/init/StaticPrefList.yaml#L10384-L10395), whose comment names `privacy.resistFingerprinting`, and the per-document setting from fingerprinting protection, in [`nsGlobalWindowOuter.cpp`](https://github.com/mozilla-firefox/firefox/blob/34ac0671eb25f31f8c56ace36e1c413dd471eb8d/dom/base/nsGlobalWindowOuter.cpp#L2093-L2096); the preference is the same in Firefox 160.0.1, which ran the `Math.tan(7)` snippet ([its release commit](https://github.com/mozilla-firefox/firefox/blob/58fed86b1b6864ad71b83c910a879d6f1a6b678b/modules/libpref/init/StaticPrefList.yaml#L10562-L10567)). How the fingerprinting setting reaches the engine was read from names and comments, not traced.
32. V8 commit [`e83fd01`](https://github.com/v8/v8/commit/e83fd01ce6cbaa15920b45cfd37d6c514475d9e8), "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`](https://github.com/v8/v8/commit/71857295b4abaf05db18741ba08bc120f3a498a1), 6 August 2014. Mozilla, [bug 967709](https://bugzilla.mozilla.org/show_bug.cgi?id=967709), "V8 is 2.8x faster at sin/cos," opened 4 February 2014: [comment 3](https://bugzilla.mozilla.org/show_bug.cgi?id=967709#c3), on V8's version, "Not particularly precise -- up to 4 erroneus \[sic\] bits"; and [comment 12](https://bugzilla.mozilla.org/show_bug.cgi?id=967709#c12) 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`](https://github.com/numpy/numpy/blob/f7fdace610a999f8babe4d3be21e1ed855aaf478/doc/source/user/basics.types.rst#extended-precision); and Quansight Labs, ["Numpy QuadDType: Quadruple Precision for Everyone"](https://labs.quansight.org/blog/numpy-quaddtype-blog), 30 September 2024. Apple's clang on arm64 was checked on 18 November 2026: `sizeof(long double)` is 8.

---

Mara Averick is a developer advocate at [Quansight](https://quansight.com/) and contributor experience lead for [stdlib](https://github.com/stdlib-js/stdlib).

---

[stdlib](https://github.com/stdlib-js/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](https://github.com/stdlib-js/stdlib) and consider [supporting](https://opencollective.com/stdlib) 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](https://www.nsf.gov/awardsearch/showAward?AWD_ID=2449410&HistoricalAwards=false).

> 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.
