## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

## Appendix H. Rounding Algorithms 101

### Introduction

We all remember being taught the concept of rounding in our younger years at school. Common problems involved monetary values, such as rounding some amount like \$26.19 to the nearest dollar (which would be 26 dollars, in the case of this example). However, although this may seem simple at a first glance, there’s a lot more to rounding than might at first meet the eye …

One key aspect of rounding that is easy to overlook (because it’s so obvious) is that it involves transforming some quantity from a greater precision to a lesser precision. As we’ve just seen, for example, rounding a more precise value like \$26.19 to the nearest dollar results in 26 dollars, which is less precise.

This means that ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required