jenner/LstGen

Very small precision problem

Closed this issue · 5 comments

I tried both the python and the javascript generations. And the calculations are correct in comparison to the BMF online calculator. But, for example,

RE4 = 195000
KVZ = 1.1
LZZ = 2
PVZ = 1
STKL = 1
R = 0
KRV = 0

I get:

steuer = 161.83
soli = 8.90

in the online calculator:

Ergebnis der Berechnung der Lohnsteuer für 2020
Die Lohnsteuer beträgt: 161,75 Euro
Der Solidaritätszuschlag beträgt: 8,89 Euro

Any help to find the issue is greatly appreciated :)

At least in the javascript version I could find where the problem was: in the obvious place of the rounding.... I'm using the popular Big.js library for that, and applying the correct codes for the ROUND_UP and ROUND_DOWN I've got the values:

steuer = 161.75
soli = 8.89

Thanks.

Now I will check the python version and come back soon :)

Not finding a way to get the python version to give the same result. It must be related to rounding as it was with the javascript. But I don't have enough python experience for that.

Still needing help :)

At least in the javascript version I could find where the problem was: in the obvious place of the rounding.... I'm using the popular Big.js library for that, and applying the correct codes for the ROUND_UP and ROUND_DOWN I've got the values:

Where exactly did you change the ROUND_UP/ROUND_DOWN code? A little context would be great! Thanks

Sorry for the delay in the answer. Only now I saw your message. For the javascript, the solution was to add the constants for the rounding equivalents to the Big.js module:

const ROUND_DOWN = 0;
const ROUND_UP = 3;

ps: I'm wondering to help creating an output in Typescript, specifically using the Big.js library, what do think?

I could get typescript version working, but it needs still some polishing: I had to add a Big.js and its equivalent .d.ts file for the .div (with three parameters) and the .longValue calls that are generated. I hope I will be able to solve that in a proper way.