v147 · JavaScript · demo
Float Drift Lab
Generate a large array of floats and compare naive loop summation against Math.sumPrecise. Watch the error accumulate in the naive column.
Expected (rational) sum: —
Naive loop (+)
—
Error: —
Math.sumPrecise()
—
Error: —
// Naive summation
function naiveSum(values) {
let total = 0;
for (const v of values) total += v;
return total;
}
// Precise summation (Chrome 147+)
const precise = Math.sumPrecise(values);
// Error = |result - expected|
see also
- Sum REPL — try your own numbers
- Back to feature index
- ChromeStatus entry
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗