SQLite Forum

ORDER BY not working for a specific DB/table
Login
"exactly rounded" is a **"term of art"** that means that a calculation is carried out "exactly" and then "rounded" to the precision of the storage format.  The "exact" part may be obtained by using larger precision intermediates or guard digits or (preferably) both.

Traditional IEEE Floating Point operations are carried out in "extended precision with guard bits" and then rounded to fit in the non-extended storage format.  More modern implementations may not meet the requirements of being exactly rounded.

And yes, there is indeed a base 10 floating point format (as well as base 16 and base 8), however, base 2 has the best (ie, lowest) cost and error.

As for money (cents) the issue is not handling the cents (1/100) which is trivial, it is how to handle the fractions of cents when doing multiplication and division.

As an aside, "accounting" is merely a rather simple "inventory control" system, just the thing which is being subject to "inventory control" is money rather than chairs.

There are only two types of "things" in this world -- there is "goop" and there is "stuff".  Goops are made into other goops by putting them in a bucket and mixing with a stick, or taking a goop and separating it into other goops.  Similarly a stuff is made by attaching one stuff to another stuff and getting a new and different stuff, or chopping a stuff into pieces yielding other stuffs.  Sometimes stuffs can be made into goops and goops into stuffs, sometimes not.