Math.sumPrecise(numbers) adds all numbers in an iterable (like an array) and gives a more exact answer than adding them one by one with +. It avoids small rounding errors that pile up in the middle of a sum.
Read the syntax below, then try the three examples to see the method in action.
Syntax
Call the method on Math. Start with this line.
JavaScript
Math.sumPrecise(numbers)
Call
What it does
Math.sumPrecise(numbers)
Returns the precise sum of all numbers in the iterable.
Built into JavaScript. Call Math.sumPrecise(...) on the Math object — no import required. Math is not a constructor, so never write new Math().
Library declarations
JavaScript
Math.sumPrecise(numbers)
Parameters
Parameter
Description
numbers
Required. An iterable of numbers, such as an array. Every item must be a number.
Return Value
Return Value
Description
Number
The sum of all numbers. An empty iterable returns -0.
JavaScript Examples
Example 1 — Add Numbers in an Array
Pass an array and get the total. The result looks just like a normal sum for easy numbers.
Huge plus tiny.1e20 + 0.1 loses the 0.1 because the big number is too large to hold it.
Wrong answer. After -1e20 the normal sum is 0.
Safe check.typeof Math.sumPrecise === "function" avoids errors in old browsers.
Precise answer. In a browser with support, Math.sumPrecise returns the correct 0.1.
Compatibility
Browser & Runtime Support
Math.sumPrecise() is a newer method. It became Baseline newly available in April 2026: Chrome and Edge 147, Firefox 137, and Safari 26.2 or later. Older browsers do not have it.
✓ Baseline · Newly available
Math.sumPrecise()
Works in current versions of the major browsers, but not in older ones. Check support before you depend on it.
82%Approx. global usage
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
Math.sumPreciseNewer feature
Bottom line: Test with typeof Math.sumPrecise === "function" and fall back to reduce() in older browsers and older Node.js versions.
Frequently Asked Questions
It adds all numbers in an iterable, like an array, and returns a sum with fewer floating point rounding errors than adding in a loop.
Normal addition rounds after every step. Math.sumPrecise keeps the exact total and rounds only once at the end.
It returns -0 for an empty iterable. In most code -0 behaves like 0.
No. Every item must be a number. If an item is a string, JavaScript throws a TypeError.
It is new. Chrome and Edge 147, Firefox 137 and Safari 26.2 or later support it. Older browsers, and many older Node.js versions, do not.
Use reduce() with +, or a small helper library for exact sums. You can also check typeof Math.sumPrecise === "function" and fall back to reduce().