JSConf JP

Numeric Types in the ECMAScript Specification, Learned Through Math.sumPrecise

LTTrack CJapanese

The ECMAScript specification uses four kinds of numbers. Number and BigInt are generally familiar, but it also uses Mathematical Values and Extended Mathematical Values, which are not values manipulated directly by ECMAScript programs. Mathematical Values can represent arbitrary real numbers, so calculations performed with them do not incur floating-point rounding errors.

Math.sumPrecise, added in ECMAScript 2026, uses Mathematical Values to define high-precision addition. This session explains how these four kinds of numbers are used in the specification, using Math.sumPrecise as an example, and introduces notation needed to read the specification, including 𝔽(x) and ℝ(x).