Dev News Daily ENDE

Node.js 27 Alpha moves to V8 15.6, adding Math.sumPrecise and changing sort and Math results

The Node.js project has published a guide to the V8 changes in the Node.js 27 Alpha release, which moves the engine from version 14.6, used by Node.js 26, to 15.6. The post, written by Joyee Cheung, notes that under the new release schedule with an Alpha phase Node.js may take breaking V8 changes during Alpha and Current, with a NODE_MODULE_VERSION bump whenever the native addon ABI changes; once 27 reaches LTS the V8 version is expected to stay put.

New language features on by default include Math.sumPrecise, which sums an iterable with less accumulated floating-point error, so 0.1, 0.2 and 0.3 add up to 0.6 rather than 0.6000000000000001; the Intl.Locale.prototype.variants getter; and the iterator methods join, includes, Iterator.zip and Iterator.zipKeyed. Import bytes and RegExp buffer boundaries sit behind flags.

The part with consequences for existing code is a list of behaviour changes. Some Math methods now use LLVM's libm, so results can differ in the last bit: Math.log(3) returns 1.0986122886681098 instead of 1.0986122886681096. Math.random with a fixed --random-seed now yields a different sequence. Date.prototype.getTimezoneOffset is no longer truncated to whole minutes for historical dates. Array.prototype.sort uses PowerSort instead of TimSort for bigger arrays; the sort stays stable, but the post's example makes 19,249 comparator calls instead of 19,220. And error.stack no longer looks the stack up through the prototype chain.

Node.js 27 Alpha moves to V8 15.6, adding Math.sumPrecise and changing sort and Math results
Node.js 27 Alpha moves to V8 15.6, adding Math.sumPrecise and changing sort and Math results — Dev News Daily

What it means

Most of this is invisible to application code. Tests are a different matter: snapshot values of floating-point maths, seeded random sequences or comparator call counts will fail on 27 without any bug having been introduced.