[GNC] GnuCash_user: rounding errors and significant digits

Bruce McCoy email_bnj_now at yahoo.com
Sat Oct 7 20:20:59 EDT 2023


Hi Everyone,

On Sat Oct 7 15:48:25 EDT 2023 John Ralls wrote:
        >GnuCash does **NOT** round prices to two decimals. 
        >Prices are always calculated to the full numeric 
        >precision of 1/2^64. Amounts and values are what 
        >get rounded to the respective commodity/currency's 
        >smallest unit. Since 15000 and 137741 have no 
        >common factors GnuCash will represent that as 
        >15000000/137741 internally and by default display 
        >it as 10 + 50000/137741. 

This is just one more example of the excellent work John has done. Another is the outstanding work John did in 2017 developing the rational number portion number in the source code in gnc-rational-rounding.hpp, just to cite one example. I am also impressed by Jim DeLa Hunt’s expertise in using rational numbers.

        >The latter irritates some users so we provide a 
        >preference that will display it as a decimal 
        >with two more fractional digits than the currency's 
        >smallest, so in the case of USD it would display 
        >as $10.8900, 

Thank you for accommodating the GnuCash user. That you do it graciously for even the users who are irritated may well be above and beyond the call of duty.

        >but the full fraction is what gets used for any 
        >computations and stored in The pricedb.

This is the excellent precision that GnuCash has. Thank you.

        >
        >Regards,
        >John Ralls

Best Regards,
Bruce McCoy




|  | Virus-free.www.avast.com |



More information about the gnucash-user mailing list