DEV Community

Cover image for Down to the last bit: stdlib across engines
Mara Averick for stdlib

Posted on Originally published at blog.stdlib.io

Down to the last bit: stdlib across engines

Can a library give the same answer on every JavaScript engine it runs on?

The previous post in this series, Whose maths is it?, showed why JavaScript's own Math can't give that:

  • The specification leaves room. Of the 37 functions on Math in ECMAScript 2026, 14 are exact, with one permitted result for each input. Another 22 are implementation-approximated: the specification describes an ideal answer and leaves the bits to each engine. The 37th, Math.random, is a case of its own: its answers are meant to differ.1
  • Engines fill that room differently. Some call the C library underneath them, some carry their own maths, and each weighs precision against speed for the work most JavaScript does.2
  • So the same call can return different bits, depending on the engine, its version, and how it was built.
  • Where Math stops, developers reach for libraries: jStat for statistics; math.js for expressions, units, and matrices; and decimal.js for arbitrary precision.3

None of that means JavaScript can't be used for numerical and scientific computing. The specification doesn't require its built-ins to be suited to it, but it does fix the arithmetic exactly, and a library can build on that. Languages people more readily reach for in numerical computing, like R or Python, have similar gaps without their packages, and they call down to C, C++, and Fortran to wrap libraries like BLAS and LAPACK. Node.js can do that too, through native addons. What JavaScript has lacked is a shared standard library of numerical building blocks that packages can build on together, and that's where stdlib comes in.

Consistency across engines is one more job stdlib takes on, and it does so by bringing its own maths instead of borrowing the engine's. Its JavaScript special functions don't call Math.sin or Math.exp, so they never reach the engine's maths library, or the platform's C library behind it. They're built from what the specification fixes. Down to the last bit, then: for the functions tested, on every engine they ran on, every number stdlib gave agreed.4 The one difference was how engines stored "not a number" on a single test input, a difference JavaScript itself can't see.

One answer, wherever it runs

stdlib's runs show one answer, starting with a single value. Here's Math.tan(7) in three browsers on my Mac:5

Chrome   0.8714479827243188
Firefox  0.8714479827243187
Safari   0.8714479827243189
Enter fullscreen mode Exit fullscreen mode

Those are three answers that differ in the last digit, each from a different maths library, and all three allowed.6 stdlib has its own tan, and in the same three browsers, it gives one answer:7

Chrome   0.8714479827243187
Firefox  0.8714479827243187
Safari   0.8714479827243187
Enter fullscreen mode Exit fullscreen mode

A single value is one data point; the broader evidence is two functions on thousands of inputs. The two are stdlib's error function, erf, and its ldexp, which scales a number by a power of two, and they ran on 4,053 test cases. Each result prints as the 64 bits of a double rather than as a decimal, so nothing is rounded away in the printing. Every line of output goes into one digest, a SHA-256 hash, so two runs with equal digests gave equal bits on every line. The code ran as a bundle: the published packages and everything they depend on, in one file, so even an engine that can't load a module by name can run it.8

Chrome, Firefox, and Safari all gave stdlib's digest. Chrome matched, bit for bit, the digest that every other run is checked against, taken on Node.js. Firefox and Safari matched it on every line but one: a single input built to be a signalling NaN, one kind of "not a number," which they store in a pattern of their own, as the specification allows.9

Chrome stored the input as fff797b7ad2f57d7; Firefox and Safari stored it as 7ff8000000000000.


The same input, stored two ways: the signalling-NaN input's 64 bits, in hexadecimal. Source: this post's companion repository, the digest outputs and the browser records.

JavaScript can't tell one NaN from another: every NaN gives the same answer to isNaN, ===, and Object.is, and NaN === NaN is false, IEEE 754's rule, shared with C and Python, not a JavaScript quirk.10 Only the raw bits, read through a typed array, which holds numbers as raw bytes, show that Firefox and Safari stored that input differently from Chrome.

A double is 64 bits: a sign, 11 exponent bits, and 52 fraction bits, read here as two 32-bit words, high and low. A value is NaN when every exponent bit is set and the fraction isn't all zeros. NaNs come in two kinds, quiet and signalling, and the first fraction bit says which: 1 for quiet, 0 for signalling, which is why it's called the quiet bit.

The high words, bit by bit, Chrome's above Firefox and Safari's. All 11 exponent bits are ones in both. The sign is 1 in Chrome's and 0 in the others'; the quiet bit is 0 in Chrome's and 1 in the others'. The other 19 fraction bits are mixed in Chrome's and all zeros in the others'. The 16 bits that differ are shaded.


The high word: the sign, the exponent, and the first 20 fraction bits.

The low word is all fraction. Chrome kept every bit the test wrote, in both words, and Firefox and Safari stored zeros here.

The low words, 32 fraction bits each: Chrome's, a mix of ones and zeros, above Firefox and Safari's, all zeros. The 21 bits that differ are shaded.


The low word: the last 32 fraction bits.

stdlib's erf and ldexp in three browsers, macOS arm64, 23 November 2026. In this table and the next two, "NaN-equal" means every line matches the digest's bits except the signalling-NaN input's, where only the stored bit pattern differs.
Browser Result
Chrome 158.0.8127.37 bit for bit
Firefox 160.0.1 NaN-equal
Safari 27.2 NaN-equal

Node.js shows stdlib's digest holding while the engine's own Math moves. One release from each Node.js line, from 20 to the 27 alpha, ran stdlib's digest, and beside it, a test of Node.js's own Math functions. Node.js's Math gave the same results on Node.js 20 and 22, then changed with every release after, most on the 27 alpha, where even Math.tan(7) moves. Node.js's Math also differed between macOS arm64 and Linux x86_64 at every release. stdlib's digest held throughout, on both.11

Node.js, one release per line, on macOS arm64 and Linux x86_64, 22 November 2026. Node.js's own Math is counted in lines of its 7,821-line test that differ; release-to-release counts are macOS arm64's.
Release stdlib's digest, macOS arm64 / Linux x86_64 Node.js's Math, against the previous release Node.js's Math, macOS arm64 against Linux x86_64
20.20.2 bit for bit / bit for bit — 23 lines
22.23.1 bit for bit / bit for bit unchanged 23 lines
24.22.3 bit for bit / bit for bit 48 lines 23 lines
26.13.1 NaN-equal / NaN-equal 57 lines 23 lines
27.0.0-alpha.0.1.1 bit for bit / bit for bit 446 lines 27 lines

stdlib's digest came out the same well beyond browsers and Node.js. Engine shells and engines from the JavaScript engines zoo, a project that builds and catalogs JavaScript engines, ran the same bundle, each in its own shell.

Other engines, each in its own shell, on Linux x86_64, Linux aarch64, and macOS arm64, October and November 2026.
Engines Result
V8 (d8), QuickJS, QuickJS-ng, GraalJS, Duktape, JerryScript, MicroQuickJS, Nova, NJS bit for bit
SpiderMonkey, JavaScriptCore, XS, Hermes, engine262, Boa, LibJS NaN-equal
Kiesel, goja, Rhino NaN-equal, through a change to how output is printed

In all, 19 engines ran stdlib's bundle, in browsers, in their own shells, and inside other runtimes, and every one gave stdlib's digest: bit for bit, or different only in the signalling-NaN input's bits.12

Why stdlib's answers hold

The 22 implementation-approximated functions are where engines may differ, and stdlib's special functions don't call them.13 stdlib's erf and ldexp are built from three kinds of part: arithmetic (+, -, *, and /), reading and writing typed arrays, and three of Math's exact functions, abs, ceil, and floor. erf needs an exponential, and it uses stdlib's own exp, not Math.exp.14

ECMA-262 specifies every one of those parts exactly. Its arithmetic is IEEE 754's, rounded to the nearest double; abs, ceil, and floor are among Math's 14 exact functions; and reading or writing a typed array is fixed to the bit.15 So on any engine whose arithmetic conforms, each input to erf or ldexp has one permitted result. That's a reading of the specification checked against stdlib's code, not something a run can prove; the runs show that the engines tested conform.

erf is still an approximation, since no finite run of arithmetic gives it exactly. But the approximation is stdlib's, written out in its own code from operations whose results are fixed, so each answer is decided once, in stdlib, rather than by each engine it runs on.1617

Rhino, a JavaScript engine written in Java, shows the same thing from the engine's side. A development build of Rhino from before a fix gave Infinity for Math.asinh(1e300), a textbook formula overflowing. The 1.9.2 release, in October 2026, fixed it by borrowing V8's algorithms. Both builds give the same digest for erf and ldexp, because neither function calls Math.asinh.18

stdlib's integer work agrees for the same reason. Three routes by which 8- and 16-bit typed arrays reach stdlib gave identical output on every engine that loaded them, as the specification says they must.19

In JavaScript, stdlib's answers hold on one condition: the arithmetic underneath has to follow IEEE 754. In these runs, that condition failed once. An emulated 32-bit ARM build of MicroQuickJS did its floating-point arithmetic in software, and one subtraction inside erf rounded wrongly, so erf came out one last bit different on 15 of 5,944 inputs, taken from stdlib's own test fixtures for erf. The same subtraction, in plain C with no engine involved, misrounds the same way, and whether the software floating-point library or the emulator is at fault isn't established.20

What stdlib needs to run

Every result so far assumes stdlib loaded first. stdlib is written to load with little more than the syntax of ES5, ECMAScript's 5th edition, and typed arrays.

stdlib's code is written to avoid the syntax that arrived after ES5: arrow functions, classes, template literals, spread and rest, and generators. That's a house rule, not a limit of the language.21

stdlib also needs typed arrays: arrays that hold one kind of number, such as Float64Array for doubles, as raw bytes in memory. Browsers shipped them in 2010 and 2011, from a specification that grew out of WebGL, the web's 3D graphics standard. ES2015 later wrote them into the standard, but engines of the ES5 era already had them.22

Typed arrays let stdlib reach a number's bits, which JavaScript has no operator for. erf, for one, needs to square part of its input exactly: it keeps only the number's leading digits, whose square fits in a double with nothing rounded, and handles the rest as a small correction. The cheapest way to clear the trailing digits is two typed arrays over the same eight bytes, one that sees them as a double and one that sees them as two 32-bit integers.23

Where an engine lacks a typed array or another built-in, stdlib's own checks reach for its fallback: its own version of the built-in, written in plain ES5. stdlib's Uint16Array, for example, is the engine's own wherever a check finds one, and a fallback everywhere else.24

MicroQuickJS, an engine for embedded systems, always runs in its own stricter mode: strict mode plus a ban on array holes, direct eval, and boxed primitives such as new Number(1). stdlib's code is strict-mode code already. On MicroQuickJS, those checks carried stdlib past three missing or quirky built-ins: Symbol, Object.defineProperty, and Date.now.25 The one exception among those checks is one that itself calls a built-in MicroQuickJS lacks, propertyIsEnumerable, in "Gaps that are stdlib's own."

stdlib aims for ES5 syntax plus typed arrays, with stdlib's own fallbacks where they're missing. otto, an ES5 engine with no typed arrays, falls within that aim, and stdlib still stops there, because those fallbacks aren't written yet: the five that erf and ldexp need, for ArrayBuffer, Uint8Array, Uint16Array, Uint32Array, and Float64Array, are stubs that throw "not implemented." otto stops at the first one it reaches, Uint16Array's.26 stdlib has written one real fallback for a typed array, for Float16Array, which ES2025 added and Node.js has only from version 24, and that fallback is the model for the rest.27

Where stdlib doesn't run, and why

In each case here, as of this writing, stdlib doesn't give a different answer: it fails to load. Half of those failures come from other projects' choices or limits. Two come from gaps in stdlib's own code, and one from a deliberate choice of stdlib's meeting an engine's limit. Each is a mismatch between what stdlib's code assumes and what an engine provides.

Different subsets of the language

otto and Elk each run a different subset of JavaScript, and the two subsets barely overlap. Elk, built for microcontrollers, runs a declared subset of ES2015; otto, written in Go, targets ES5.28 Here are four separate one-line programs, and what each engine made of them:

var a = 1; console.log(a);   // otto runs it; Elk: 'var' not implemented
let a = 1; console.log(a);   // Elk runs it; otto: Unexpected identifier
const a = 1; console.log(a)  // otto: Unexpected reserved word; Elk: 'const' not implemented
console.log(1 + 2);          // both print 3
Enter fullscreen mode Exit fullscreen mode

Neither engine runs const. So no program that declares a variable with var, let, or const runs on both, and one that declares nothing does.

stdlib writes ES5, and Elk leaves out var on purpose, while stdlib declares everything with it. That's a mismatch of aims, not a limit on either side. Every engine in today's browsers and in Node.js runs ES5, though: JavaScript's standard doesn't drop what existing code relies on, even features it calls undesirable, and those engines keep to it, which is why a page written in the 1990s can still run in a browser today.29

ES5 also reaches past those engines: all five stdlib packages tried ran unmodified from source on MicroQuickJS,30 and one bundle ran in every engine shell in the tables, none of which can load a module by name.

otto is Elk's opposite: an ES5 engine with no typed arrays is one stdlib aims to run on. Where it stops is a gap of stdlib's own.

Engines that stop early

Quanta, Porffor, and scriptc fail before any stdlib maths runs, each for its own reason, as measured at the versions tested:

  • Quanta: its parser hangs on a line of stdlib's, new ctors['uint16'](1), so the bundle never loads.
  • Porffor, which compiles JavaScript to C ahead of time: stdlib's var UINT32_MAX collides with a macro of the same name from C's <stdint.h> in the code it generates.31
  • scriptc, another ahead-of-time compiler, meets a deliberate choice of stdlib's. stdlib's fallback for Object.defineProperty keeps its own references to Object.prototype's older accessor methods, such as __defineGetter__, taken as it loads, so that code which later changes Object.prototype can't change what the fallback calls.32 scriptc doesn't support reflection on Object.prototype, and that includes any reference to those methods, so stdlib doesn't get past loading there, even though scriptc has Object.defineProperty and the fallback goes unused. Taking the references inside the fallback's function instead, so they're made only when it's called, lets scriptc 0.4.16, the current release, give stdlib's digest bit for bit. That change was written for a test, and it relaxes the guard, so it isn't one stdlib would make.33

Gaps that are stdlib's own

Two of the failures, on otto and MicroQuickJS, are in stdlib's own code, not in the engine: places where what an engine can't load is stdlib's compatibility code rather than its maths. Each is a matter of compatibility; the unguarded check is the one stdlib treats as a bug.

  • The typed-array stubs, stdlib's fallbacks for ArrayBuffer, Uint8Array, Uint16Array, Uint32Array, and Float64Array, which throw "not implemented" instead of standing in for the built-ins. otto stops there, and fallbacks for all five, written for a test, ran erf and ldexp on it.34
  • An unguarded check, on MicroQuickJS. stdlib's path for strided array operations doesn't load there, because one of its checks calls propertyIsEnumerable, which MicroQuickJS lacks, without first checking for it. Everything else tried on MicroQuickJS ran, which makes it the near miss.35

Unlike the references scriptc meets, the unguarded check is filed as issue 16798; a test of one way past it, and its run, are in the companion repository's mqjs-guard-spike/.

Decided once, in stdlib

stdlib's answers held still wherever stdlib could run and be read: in three browsers, in five Node.js releases, and on 19 engines in all, apart from one signalling NaN's stored bits. They hold because stdlib's JavaScript brings its own maths, built only from operations the specification fixes exactly. In Math, each answer is somebody's decision: an engine's, a build's, or a library's. In stdlib, the answer is stdlib's, decided once. Where stdlib can't run, the reason is reach, not arithmetic: an engine's chosen subset, an engine that stops first, or code of stdlib's that an engine can't load.

A library can hold its answers still without a runtime's help. The next post asks what that's worth on Bare, a small and modular runtime for an app's portable core, the code meant to be identical on every device. Bare's engine is chosen when it's built, and an app isn't meant to change between engines, so the runtime can hold still while the engine changes.


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. Ecma International, ECMA-262, 17th edition: ECMAScript 2026 Language Specification, June 2026, §21.3.2, Function Properties of the Math Object, counted from each function's own steps: 22 return an implementation-approximated value, 14 are exact, and random is implementation-defined. The term is defined in §4.4.1. ↩

  2. 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 "a little less precise overall," which its author called "an acceptable tradeoff here." V8 commit e83fd01, "Implement Math.sin, cos and tan using table lookup and spline interpolation," 12 November 2013; Mozilla, bug 967709, opened 4 February 2014, and comment 12 for the patch. ↩

  3. Each project's README, at the commit linked: jStat, "native javascript implementations of statistical functions"; math.js, with an expression parser, units, and matrices; and decimal.js, "an arbitrary-precision Decimal type for JavaScript." ↩

  4. Every engine they ran on whose arithmetic follows IEEE 754, the floating-point standard behind JavaScript's numbers. One emulated 32-bit build didn't, and there erf differed in its last bit on 15 inputs; "Why stdlib's answers hold" has the details. ↩

  5. The runs behind this post were on my Mac, an Apple M1 Pro on macOS 26.7.3; on a Claude Code Cloud x86_64 VM; and on OrbStack aarch64 on my Mac, a Linux VM. Elsewhere in the post, each goes by its architecture: macOS arm64, Linux x86_64, and Linux aarch64. ↩

  6. Run on 18 November 2026, once in each browser's console, on macOS arm64, all three browsers running natively 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 Chrome 3febe2e6e13eea79, Firefox 3febe2e6e13eea78, and Safari 3febe2e6e13eea7a, three neighboring doubles. Chrome's answer comes from LLVM's maths library, Firefox's from fdlibm, and Safari's from macOS's own C library: Whose maths is it?, with its runs in blog-whose-maths-is-it-1. ↩

  7. stdlib's tan is the published package @stdlib/math-base-special-tan 0.3.1 (source at e6d0587), bundled the same way as the digest's bundle and run by the same page, which prints stdlib's tan(7) beside the browser's own Math.tan(7). Recorded on 23 November 2026 on macOS arm64, once in each browser, at the same versions as the Math.tan(7) run: stdlib's tan(7) is 3febe2e6e13eea78 in all three, and each browser's own Math.tan(7) has the same bits as on 18 November. ↩

  8. Built with esbuild 0.25.10 (--bundle --format=iife --target=es5) from @stdlib/math-base-special-erf 0.2.6 and @stdlib/math-base-special-ldexp 0.2.5. The bundle prints 4,054 lines: 4,053 results, then a count. The digest every run is checked against is from Node.js 24.19.0, on Linux x86_64, 2 November 2026: 0bf2fbde...b51, or c17d8dbb...0bb with every NaN rewritten as NaN. The browser records were taken on 23 November 2026, on macOS arm64, by opening a page served on localhost from this post's companion repository, which runs the bundle unchanged in the browser's own engine and hashes its output; each browser's version is from its About page. The bundles, the page, and every run are in the companion repository, blog-stdlib-across-engines-1, in bundles/, page/, and digest/. ↩

  9. The harness stores one signalling NaN, fff797b7ad2f57d7, into a Float64Array and reads its bits back; it's the harness's own round trip, not one of stdlib's results. When a NaN is written into a typed array, ECMA-262 lets the engine choose its encoding, though "An implementation must always choose the same encoding for each implementation distinguishable NaN value" (§25.1.3.17, NumericToRawBytes). Firefox and Safari store it as 7ff8000000000000, as SpiderMonkey's and JavaScriptCore's own shells do. V8 quieted it to ffff97b7ad2f57d7 once its Maglev compiler optimized the store, from V8 14.4.76 to 15.5.34, which Chromium bug 559075198 reported as contrary to that sentence; V8 commit 1a723a5, "Preserve NaN bits in constant typed array stores," fixed it. Node.js 26.13.1 carries V8 14.6, inside that window, which is why its row differs on that line. Neither browser's line is printed on its own; both follow from digests. Chrome's bit digest is the reference's, 0bf2fbde..., and Firefox's and Safari's, d89e89a8..., is also the digest of LibJS's raw output, which differs from the reference only on line 3382, where it reads ldexp 7ff8000000000000 424 7ff8000000000000. ↩

  10. Bartek Szopka walks through a double's layout, NaN included, in "Everything you never wanted to know about JavaScript numbers" (JSConf EU 2013). His IEEE 754 visualiser (source at 3d179e0) lets you flip a double's bits yourself: set every exponent bit and any non-zero fraction, and the value is NaN. A double has 2⁵³ − 2 such patterns, counting both signs. ↩

  11. Each release called by its full path, recording its own process.version and process.versions.v8: 20.20.2 (V8 11.3.244.8-node.38), 22.23.1 (12.4.254.21-node.56), 24.22.3 (13.6.233.17-node.63), 26.13.1 (14.6.202.34-node.40), and 27.0.0-alpha.0.1.1 (15.6.75.50-node.14). On Linux x86_64 they ran on Ubuntu 24.04.5. stdlib's digest was checked for both bundles, each run twice. The Math test runs Node.js's own Math functions on 7,820 cases, one line each, plus a count. Between macOS arm64 and Linux x86_64, 12 of the 23 lines that differ on 20 to 26 differ in value and 11 in how a NaN is encoded; on the alpha, it's 22 and 5. From 26 to the alpha, 446 lines change on macOS arm64 and 440 on Linux x86_64. Math.tan(7) gave the same bits on both at every release. Which maths library each release's tan comes from wasn't read. ↩

  12. The October engines ran on 21 October 2026, on Linux x86_64 and again on macOS arm64, where every engine at its Linux x86_64 version reproduced that row; MicroQuickJS, at 6d4d7eb, ran on macOS arm64, in two builds. Nova (d85a2f8), NJS 0.9.6, LibJS (Ladybird e1ba577), Kiesel (0.1.0-dev+20deb11f1), goja (622d100), and a development build of Rhino ran on Linux x86_64 on 2 November 2026, and Rhino 1.9.2 on Linux aarch64 on 22 November 2026. LibJS ran with two of its own shell flags, --raw-strings --disable-ansi-colors. Kiesel, goja, and the Rhino development build ran through labelled variants that change only how output is printed or read, never the code that drives the test or the bundles: Kiesel prints toString(16) in decimal from 2³¹ up, goja's console writes timestamped lines to standard error, and that Rhino build's print loses its last line into a pipe. The count of 19 includes V8, SpiderMonkey, and JavaScriptCore once each, whether they ran in a browser, a shell, or a runtime. The emulated 32-bit ARM build of MicroQuickJS, in "Why stdlib's answers hold," isn't one of the runs behind the 19. ↩

  13. stdlib's own lint rule, stdlib/no-builtin-math, forbids calling the built-in Math (etc/eslint/rules/stdlib.js at b64fd0c, line 4366). Where stdlib does call one, it's in a package that wraps a single exact function, with the rule switched off for that line: abs, ceil, floor, round, and sqrt, plus the single-precision absf, ceilf, and floorf. A search of the JavaScript in every package under math/base/special at that commit, comments aside, finds no call to any of the 22. ↩

  14. At the versions tested: erf 0.2.6, which requires stdlib's exp at line 38; ldexp 0.2.5; and exp 0.2.5. Every Math. in the bundle is Math.abs, Math.ceil, or Math.floor, by a search of bundles/npm.js. On the digest's inputs, only abs and ceil run: floor is bundled, but never called. ↩

  15. ECMA-262, 17th edition: §6.1.6.1.7, Number::add, with the other arithmetic operations in §6.1.6.1, The Number Type; §21.3.2.1, Math.abs, §21.3.2.10, Math.ceil, and §21.3.2.16, Math.floor; and typed-array access through §25.1.3.14, RawBytesToNumeric and §25.1.3.17, NumericToRawBytes. ↩

  16. erf and ldexp, apart from the signalling-NaN input's stored bits, on the engines that could run them. The same reasoning covers stdlib's gamma and log1p, which gave one answer per input on 24 builds on macOS arm64, and it holds only where the arithmetic underneath conforms to IEEE 754. What's measured here is agreement, not accuracy. ↩

  17. Another project states the same aim for its own maths. Sagebrush, announced by William Stein on 16 November 2026 (post; source at 1718f8b; archived), "a project of SageMath, Inc." by its site's footer, has a module, fdlibm.ts, whose header opens "Elementary functions that give the same bits in every JavaScript engine" (at 215ea65). That's a declared aim; none of its code was run for this post. ↩

  18. Rhino's 1.9.2 release notes, 27 October 2026: "Fix inconsistencies in the "Math" object by backporting algorithms from V8." The fault was reported and fixed upstream. The development build is the JavaScript engines zoo's 2.0.0-SNAPSHOT at 7386aa0, run on Linux x86_64 on 2 November 2026, on a terminal, since that build's print loses its last line into a pipe. Rhino 1.9.2 ran on Linux aarch64 on 22 November 2026, on OpenJDK 25.0.2, piped and on a terminal, each twice. Both give the bit digest d89e89a8..., which matches the Node.js digest on every line but the signalling-NaN input. The two builds ran on different hosts. ↩

  19. math/strided/ops/add and mul, blas/ext/base/gsorthp, and number/uint16/base/mul and number/uint8/base/add through strided/base/binary, with 4,096 elements and the extremes of each type, on every binary in the Linux x86_64 engine set, on 22 October 2026. MicroQuickJS and JerryScript completed after one named change each. Every output matches an independent check that recomputes it from the printed inputs with unbounded integers and ECMA-262's conversion rules. ↩

  20. MicroQuickJS at 6d4d7eb, built with its software floating point for 32-bit ARM and run under the QEMU 8.2.2 emulator. erf differed on 15 of 5,944 inputs, each by one unit in the last place, the smallest difference two doubles can have. Every one traces to erf's final subtraction, and that subtraction alone, in plain C, misrounds the same way on five emulated ARM CPUs. The exact difference lies 0.95 of a unit in the last place above the result and 0.05 below the next double, so round-to-nearest, which IEEE 754 and ECMA-262 require, gives that next double, as native hardware does. Whether the fault is libgcc 13.3.0's software subtraction or QEMU's emulation of it isn't established. ↩

  21. stdlib's ESLint no-restricted-syntax rule, in etc/eslint/rules/style.js at b64fd0c, line 1191. The same rule also bans with and labels, which ES5 has. ↩

  22. The specification is Vladimir Vukicevic and Kenneth Russell, eds., Typed Array Specification, version 1.0, 8 February 2011, at https://www.khronos.org/registry/typedarray/specs/1.0/ (archived 31 July 2011), whose abstract says "The functionality described here originated in the WebGL specification"; Khronos's own URLs now redirect to ECMA-262 6.0's typed-array section. Khronos released WebGL 1.0's final specification on 3 March 2011 (press release). The first browser versions with ArrayBuffer and the typed-array views, by MDN's browser-compat-data at 2f696a2 (ArrayBuffer.json), with release dates from its browser files: Chrome 7, 19 October 2010; Firefox 4, 22 March 2011; and Safari 5.1, 20 July 2011. ES2015 is ECMA-262's 6th edition, with §22.2, TypedArray Objects, and §24.1, ArrayBuffer Objects. Nicholas D. Matsakis, David Herman, and Dmitry Lomov, "Typed objects in JavaScript," Proceedings of the 10th ACM Symposium on Dynamic Languages (DLS '14), October 2014, 125–134, doi:10.1145/2661088.2661095, describe typed arrays as an API "initially standardized by the Khronos Group," then due for inclusion in ES6, and supported by most JavaScript implementations as of 2014. One ES3/ES5 implementation of the specification is Joshua Bell's polyfill, the source of es-shims' typedarray (typedarray.js at 716a3f3, lines 30–32). ↩

  23. erf/lib/main.js, lines 388–389, at b64fd0c, whose comment calls the shortened number "pseudo-single (20-bit) precision x." There, setLowWord(ax, 0) clears the low 32 of the double's 52 fraction bits, leaving 21 significant bits with the leading 1, so the square needs at most 42 bits and fits in a double's 53 without rounding. The two views are in set-low-word/lib/main.js, lines 30–31, which erf requires at line 39. The same conversion can be done with arithmetic alone, as fallbacks written for a test on otto do; the typed arrays are cheaper. ↩

  24. array/uint16/lib/index.js at b64fd0c, which requires @stdlib/assert/has-uint16array-support at line 35 and chooses the built-in or the fallback at lines 43–47. array/buffer, array/uint8, array/uint32, and array/float64 do the same, at the same lines. ↩

  25. MicroQuickJS's README at 6d4d7eb, "Stricter mode": "MQuickJS only supports a subset of JavaScript (mostly ES5)," always "in stricter mode where some error prone JavaScript features are disabled." The three built-ins are reached through stdlib's assert/has-symbol-support, utils/define-property, and time/now. ↩

  26. The lib/polyfill.js of array/buffer, array/uint8, array/uint16, array/uint32, and array/float64, each lines 21–31 at b64fd0c: "TODO: write polyfill," then throw new Error( 'not implemented' ). otto reaches Uint16Array's first, through stdlib's byte-order check, which constructs a Uint16Array as it loads (assert/is-little-endian/lib/main.js, line 42). That was run on otto v0.5.1, on Linux aarch64 on 22 November 2026, with a printer that uses no typed array itself; stdlib failed with "Error: not implemented" as it loaded, before erf ran. ↩

  27. Float16Array is §19.3.13 of ES2025. MDN's browser-compat-data at 2f696a2 lists it in Node.js from 24.0.0 (Float16Array.json). stdlib's fallback is array/float16/lib/polyfill/ at b64fd0c, added in May 2026 by pull request 7435. ↩

  28. Elk's README at a9bb856, which says Elk "implements a small but usable subset of ES6" and lists "No var, no const. Use let (strict mode only)" and "No arrays, closures, prototypes, this, new, delete." otto's README at v0.5.1: "Otto targets ES5. Some ES6 features e.g. Typed Arrays are not supported." The probes ran twice each on Linux aarch64 on 22 November 2026, on otto v0.5.1, built with Go 1.24.7, and on the JavaScript engines zoo's build of Elk at a9bb856. Elk's rejection of const is from Linux x86_64 on 2 November 2026. otto's is from macOS arm64 on 23 November 2026, on otto v0.5.1 built with Go 1.27.4, where var, let, and the declaration-free program, run again beside it, gave the same results as before. ↩

  29. ECMA-262, 17th edition, §2, Conformance: a conforming implementation must support all the "program syntax and semantics described in this specification," and the features it keeps in Legacy subclauses have "one or more undesirable characteristics. However, their continued usage in existing applications prevents their removal from this specification." var isn't one of those; it's core syntax, in the variable statement. ↩

  30. erf, gamma, string/format, and time/now with time/tic, chosen to probe the subset: erf and gamma for maths, string/format because it tokenizes with a regular expression, and the two timing packages because an engine whose Date is limited is where a timing harness would break. Each was bundled from stdlib's source at 8e3f446 with esbuild 0.25.10 and run on MicroQuickJS at 6d4d7eb. The bundles needed one shim, for Object.getOwnPropertyNames, which esbuild's own module wrapper calls and MicroQuickJS lacks. Whether 29 more packages, which call new Date( or getOwnPropertyNames( in their code, run there hasn't been tested. ↩

  31. Measured on Linux x86_64 on 2 November 2026. Quanta (quanta.js.org), the JavaScript engines zoo's build at 767a49f, hangs while parsing, even when a minimal case sits inside if (false); the bundle prints the line as new ctors["uint16"](1). Porffor alpha 19 fails in GCC 13.3.0, and the same failure reproduced on Linux aarch64 on 3 November 2026. Neither is filed upstream. A newer release, Porffor alpha 25, stopped on the test environment before reaching the point where alpha 19 failed, so whether that failure persists isn't known. ↩

  32. Node.js guards its own core code the same way: its "primordials" are copies of JavaScript's built-ins, captured when Node.js sets up each context and before user code runs, so later patches to globals don't reach its built-in modules (lib/internal/per_context/primordials.js at dd7bff5, lines 5–7). ↩

  33. scriptc 0.4.16 on macOS arm64, 23 November 2026, linked by Apple clang 21.0.0, on the same digest driver as every other engine, bundled for this run both from the published packages and from stdlib's source at b64fd0c, each binary run twice. As published, both stop as they load with "Uncaught TypeError: scriptc: Object.prototype reflection and mutation are not supported yet [SC1090]." SC1090 is the code scriptc gives a construct it doesn't support, and its documentation lists reflection on Object.prototype as unsupported, naming isPrototypeOf and __proto__ ("Limitations," Builtin APIs, a live page, read 23 November 2026). The read is at the fallback's module level, with three like it, in utils/define-property/lib/polyfill.js, lines 32–35, and index.js, line 43, requires the fallback whether or not it's used. The reads are deliberate: caching the methods as the module loads guards against later changes to Object.prototype, sometimes called prototype pollution. The documentation doesn't name the older accessor methods; that scriptc doesn't support them is our own measurement. On 0.4.16, every reference to them through Object.prototype, from a plain read to typeof and the in operator, compiles, and is then refused with SC1090 when it runs. The test change, patch 2b, moves the four reads inside the fallback's function, defineProperty, so they run only when it's called, which gives up the guard. Loading the fallback only where it's used, with a require inside a branch, isn't an option either, since that breaks the translation of stdlib's CommonJS into ES modules. The version first tested, scriptc 0.4.7, stopped at the same read on Linux x86_64 on 2 November 2026. With the change, 0.4.7 then stopped on a bug of its own, on macOS arm64: a built-in constructor passed around as a value lost its static properties, so stdlib's negative infinity, which it reads from Number.NEGATIVE_INFINITY, came out undefined. scriptc fixed that in 0.4.8, which, with the change, gives the digest bit for bit too. ↩

  34. The fallbacks in that test are a feasibility spike, not stdlib's code: ES5 versions of ArrayBuffer, Uint8Array, Uint16Array, Uint32Array, and Float64Array, written for the test and swapped in for stdlib's stubs at bundle time, with stdlib itself unchanged. On otto v0.5.1, on macOS arm64, 23 November 2026, four bundles, built from the published packages and from stdlib's source, each run twice, printed output that matched the Node.js digest on every line but the signalling-NaN input: ES5 code can't see a NaN's sign or fraction bits, so a fallback written in it can't keep them. The proposal to write them is issue 16795; the test and its runs are in the companion repository's otto-polyfill-spike/. ↩

  35. At b64fd0c: the unguarded call is assert/is-enumerable-property/lib/native.js, line 49, reached on MicroQuickJS through @stdlib/utils/keys; the strided path also needs isPrototypeOf, through @stdlib/assert/is-plain-object, and with two small shims it loads and gives the same output as everywhere else. The stubs' lines are in the footnote on where otto stops. ↩

Top comments (0)