Multi Currency Accounting Bug / Error or Simple Fix?

Hello, I get a very annoying error when I am trying to account in two currencies. It is so small yet so extremely frustrating because it is not correct! There is a 0.00000000000005 discrepancy in the account balance. Whatever I do I get this.

Even if I set the currency exchange to 1=1 (which should mean there should not be any difference between company currency and account currency) I still get this -0.00000000000005 discrepancy! What is going wrong?


Please help. I have been sitting 24 hours with this pulling my hair trying to get it to be correct. And my VAT return is due in a few days. Any help will be appreciated.


There’s nothing actually wrong here - a forum or web search on ‘rounding’ ‘precision’ or ‘round-off’ will inform you what this is about.

These docs explain how to change decimal precision

Thanks for trying to help. I also thought that was the thing in the beginning. But then realized no matter what floating precision I used I would always get that erraneous amount.

The fact is that $356.78 - $44.85 = $313.93 (try it on your calc) it should never produce that many decimals in the first place!

Also changing the conversion rate between base currency and account currency to 1:1 means they should calculate equally. But as you can see on the screenshot、 the base currency got it correct with £313.9300000… but account currency somehow for no reason snatched a $0.000000…5 from the correct amount!

It seems to me even after you looked at it that it must be a bug. Why is erpnext “snatching” this small amount from the correct amount? Still open for any answer to this.

Indeed yes, for example these outline the ‘problem’ What Every Computer Scientist Should Know About Floating-Point Arithmetic

edit: Here’s another case Error: Quantity (25.000001) cannot be a fraction in row 1

Now, I am not a computer scientist or anything. But it feels to me that a skilled developer should not have to dig too deep to find the error. Getting rid of a bug like that ought to not require rocket science. 356.78 - 44.85 = 313.93 Even a basic calculator from the '80s could get that simple calculation right. Even my head math could get that right and I’m even not that good at head calculations! LOL

It is super sad as an end user to find promising software like this, only to discover bugs like these. (all be it multi currency which is perhaps a bit more advanced than one currency). But it just renders the whole enterprise arsenal a bit useless.

It’s like finding your dream office only to find a little bug in the office chair biting you, and that small bug just makes the whole experience unbearable.

Well my VAT return is due in just two days. Can’t do more bug seeking now. Got to get the actual accounting done.

I have my hopes up for erpnext in the future I might come back to see the progress. It is still a promising erp.

This is a design decision not an error! Not to worry, Khan is a first-rate resource for self-guided learning - they explain the roundoff errors with floating point numbers issue well

edit: If your instance is self hosted and you have console access, this illustrates the basic issue and how you can make it go away :wink:

frappe@ubuntu:~/frappe-bench$ bench console

In [1]: 0.1 + 0.2
Out[1]: 0.30000000000000004

In [2]: round(0.1 + 0.2,2)
Out[2]: 0.3

I do not understand that kind of logic. I am just a normal end-user interested in automating my business workflow so I can focus on my core business. I just want 1 + 1 to become 2 and not 1.999999999995.

That is my only need from my accounting software. I am using for my accounting now because the values returned in the ledger worked like I anticipated there. And I really need to send in my VAT return in now and just need it to work.

It’s a pity, cause I kind of was hoping for ERPnext to “win” during testing different solutions. I had great hopes for it. But that small discrepancy that 358.78 - 44.85 became 313.92999999999995 and not 313.93 as I expected, just started to feel like it would drive me crazy.

ok got it - someone comfortable with high school math can likely help you here before you go too crazy :wink:

Not needed. I already solved the problem. The simple way. :wink: No more errors on my balance report. Now that is what I call beautiful mathematics… [Solved]

Excellent what did you do - please share for all to benefit from your learning!?

@aleogr … Hi Alex,

it would be really appreciable if you share the solution for the community… can you please…

thank you

I am an end-user, I only look for simple solutions that work out of the box. I had to get my accounting done in multiple currencies and VAT-return sent in within a few days time. I already had found another software that did not produce this error that did the job. That is the simple fastest solution for an end-user like me, to solve my problem. So now my VAT-return is sent in on time and books are displaying the correct values.

Best regards,