[GNC] GnuCash_user: rounding errors and significant digits

Michael or Penny Novack stepbystepfarm at comcast.net
Fri Oct 27 13:06:11 EDT 2023


Beating what should be a dead horse.

Let A, B, and C be rational numbers (ie: expressed in the form X/Y where 
X and Y are integers). Let D be a function that represents the decimal 
equivalent of a rational number to some finite number of decimal places.

A + B = C does NOT imply that D(A) + D(B) = D(C)

In other words, the fact that a set of books is balanced when the 
amounts are represented as rationals does not mean would be balanced 
once these rational numbers are converted to decimals.

By and large, we keep our books as decimals (the books as we see them) 
and entities that require reports from us are going to require values as 
decimal (possibly rounded to some specified whole units of some currency 
<< THAT introduces a second level of complexity as it might be required 
that those reports balance >>

Gnucash is not making "errors" in arithmetic. Simply differences 
intrinsic to the operation "round".


Michael D Novack




More information about the gnucash-user mailing list