<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 8, 2014 at 10:55 PM, Josh Berkus <span dir="ltr"><<a href="mailto:josh@agliodbs.com" target="_blank">josh@agliodbs.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 05/08/2014 08:03 AM, Bradley M. Kuhn wrote:<br>
>> ???<br>
>> > Ledger is written in Python<br>
> I respond with ??? in response, since Ledger-CLI is written in C++. :)<br>
><br>
<br>
</div>Sorry, I looked up ledger-cli on github and found an implementation in<br>
Python.  I'd assumed that that was the core project; apparently not.<br>
<br>
I will argue that fixing ledger-CLI's rounding problems should be out of<br>
scope for this project, a waste of time and money.  If it has rounding<br>
issues, then the answer is to abandon ledger-CLI for something else, or<br>
reimplement it using code which supports fixed-point arithmatic (maybe<br>
even that Python project I found).  Ledger-CLI's functionality is not<br>
that complex.<br>
<br></blockquote><div>I am aware of packages available for decimal representation in Python.  Ledger-cli uses integer rationals for internal representations and calculations. This provide more accuracy than fixed point in long term. It also uses correct rounding before displaying the floating string. The problem is that you cannot set this display precision before hand. So if you have a transaction less precise than the actual amount. For example, if you have all the entries of the format $0.0 but the balance amount after calculations amounts to $0.0169, it will be rounded to $0.0. This error is carried further in register. Also you cannot set this precision by an option as of now(I didn't find and I am waiting for an answer)  and I hope to code that. It takes its cue from the entries parsed and the precision of displayed amounts in the input file.<br>

</div><div>Another point is to prove by comparison between fixed point(decimal), floating point(binary) and Integer rationals that the problem of accuracy does not occur. This is possible by writing test which are sure to produce rounding errors in floating point. Truncation errors in calculations while using fixed-point and how this is tackled in ledger cli. <br>

</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This whole project is in serious danger of being consumed by yak-shaving.<br>
<div class="im HOEnZb"><br></div></blockquote><div><br></div><div><br></div><div>Regards<br></div><div>Tripun Goel <br></div></div><br></div></div>