Get the latest tech news

How to Correctly Sum Up Numbers


When you learn programming, one of the first things every book and course teaches is how to add two numbers. So, developers working with large data probably don't have to think too much about adding numbers, right? Turns out it's not quite so simple!

For floating point operations, the Rust compiler guarantees compatibility with IEEEÂ 754 which means that generally overflows lead to infinity values and underflows are converted to zero. Throwing errors in these cases makes it easier to use the system: instead of returning potentially meaningless results, the query engine lets the user know that they aren’t using the functions in a way that’s safe. Not only does this make overflows much less likely (or even impossible with 128-bit integers), larger intermediate results also allow for better precision when calculating some aggregation functions, such as avg().

Get the Android app

Or read this on Hacker News

Read more on:

Photo of numbers

numbers

Related news:

News photo

Suda51 reckons "everyone cares too much about the numbers" on Metacritic

News photo

Rocksteady reportedly begins a round of layoffs after Suicide Squad: Kill the Justice League's shortcomings, slashes its QA team's numbers in half | So drops the other foot.

News photo

Numbers Go Up