>>>>> Jeffrey Brent McBeth <[email protected]> writes:
> On Thu, Aug 22, 2013 at 09:53:26PM -0700, Charles Merriam wrote: >> It's a nice idea. I have no four digit amounts; this gives no output. >> ledger -w -f 2013.led register | grep "\.\d\d[1-9]" My guess is ledger is >> doing floats instead of paired fixed precision, so some amount doesn't >> represent well in IEEE exactly, triggers the longer field, and then rounds >> back to zero ten-thousandths of a penny anyway. > The ledger docs are pretty explicit in the fact that they use floats for > amounts. I just grepped through the code, and there are astoundingly few > instances of the word float or double in the code, and they appear at first > blush to all be related to size calculations rather than storing any > amounts. Ledger *NEVER* uses floats for monetary values, but only for imprecise things where loss of precision does not matter. Rather, Ledger uses infinite-precision rational numbers, which are rendered to floating-point at display time, in order to round the value to a fixed number of decimal places. This is actually problematical if you want to do "fixed-point accounting", which rounded amounts are intentionally shaved; but it is a benefit if you wish to never lose track of fractions of commodities, no matter how small. John -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
