Skip to content
Back to the collection

Small-data computing

Hans-J. Boehm

2017 · Communications of the ACM

Read the paper
HN score
0
Mentions
6
Readers
5
Months
4
What’s in a score?

From the abstract

Rounding errors are usually avoidable, and sometimes we can afford to avoid them.

Metadata: Crossref. Abstracts retain their original authors’ rights.

In the conversation

Original HN comments, with labels from simple text rules. A label describes the whole comment and may miss context or irony. Read the discussion to make up your own mind. About the labels

6 selected excerpts · 6 total mentions

lifthrasiir
Neutral mention · rule
You can instead list your criteria for good number format and look at alternatives with those lenses. Floating point is designed for a good balance between dynamic range and precision, and IEEE 754 binary formats can be seen as a FP standard particularly optimized for numerical calculation. There are several other FP formats. The most popular one is IEEE 754 minus subnormal numbers, followed by bfloat16, IEEE 754 decimal formats (formerly IEEE 854) and posits. Only first two have good hardware supports. The lack of subnormal number means that `a <=> b` can't be no longer rewritten to `a - b <=> 0` among others but is widely believed to be faster. (I don't fully agree, but…
Read the full comment
it's indeed true for existing contemporary hardwares.) IEEE 754 decimal formats are notable for lack of normalization guarantee. Posits are, in some sense, what IEEE 754 would have been if designed today, and in fact aren't that fundamentally different from IEEE 754 in my opinion. Fixed-point formats share pros and cons of finitely sized integer numbers and you should have no difficulty to analyze them. In short, they offer a smaller dynamic range compared to FP, but its truncation model is much simpler to reason. In turn you will get a varying precision and out-of-bound issues. Rational number formats look very promising at the beginning, but they are much harder to implement efficiently. You will need a fast GCD algorithm (not Euclidean) and also have to handle out-of-bound numerators and denumerators. In fact, many rational number formats rely on arbitrary-precision integers precisely for avoiding those issues, and inherit the same set of issues---unbounded memory usage and computational overhead. Approximate rational number formats are much rarer, and I'm only aware of the Inigo Quilez's floating-bar experiment [1] in this space. Interval/ball/affine arithmetics and others are means to automatically approximate an error analysis. They have a good property of being never incorrect, but it is still really easy for them to throw up and give a correct but useless answer like [-inf, inf]. Also they are somewhat awkward in a typical procedural paradigm because comparisons will return a tri-state boolean (true, false, unsure). Nevertheless they are often useful when correctly used. Fredrik Johansson's Arb [2] is a good starting point in my opinion. Finally you can model a number as a function that returns a successively accurate approximation. This is called the constructive or exact real number, and simultaneously most expensive and most correct. One of the most glaring problems is that an equality is not always decidable, and practical applications tend to have various heuristics to get around this fact. Amazingly enough, Android's built-in calculator is one of the most used applications that use this model [3]. [1] https://iquilezles.org/articles/floatingbar/ [2] https://arblib.org/ [3] https://dl.acm.org/doi/pdf/10.1145/2911981
svat
Neutral mention · rule
Great article. As it says, it's a translation into Javascript of the Java code from the Android calculator, and the article it references ("Small-data computing: correct calculator arithmetic" by Hans-J. Boehm) is really an awesome read: available at https://cacm.acm.org/magazines/2017/8/219594-small-data-comp... or https://dl.acm.org/doi/10.1145/2911981 and PDF at https://dl.acm.org/doi/pdf/10.1145/2911981 — the Android calculator is a hidden gem of an application.
bloomer
Neutral mention · rule
The default Android calculator app by Hans Boehm (developer of the Boehm Garbage Collector as well) does this by using the computable real numbers. https://dl.acm.org/doi/10.1145/2911981 Provides a good overview of how it works and perms website has more information. What’s cool about the computable reals implementation is you can increase the precision after the fact and it will recalculate up to that precision. Basically it memoizes the steps of the calculation and how they affect the precision.
bloomer
Neutral mention · rule
This isn’t a performance optimization but rather an accuracy optimization. Even if the requested output is a double (64-bits) the intermediate calculations often need to be done to higher precision to get fully accurate answers. Note that the desktop calculator on Android does the same analysis by using computable numbers. https://dl.acm.org/doi/10.1145/2911981 Is a nice overview.

Keep following the thread.

More in Other research

More from the same topics.