We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi. With such input:
percentRound([1, 1, 1], 2);
Result is:
[ 33.340000000001936, 33.33000000000194, 33.33000000000194 ]
I was expecting to have just 2 numbers after the decimal point here.
The text was updated successfully, but these errors were encountered:
Hi,
Thanks for reporting this. It is due to how javascript handles floating points : some explanation here
in javascript : var x = 0.2 + 0.1; // x will be 0.30000000000000004
var x = 0.2 + 0.1; // x will be 0.30000000000000004
I will look into a fix for this. In the mean time as a workaround you can do this :
percentRound([1, 1, 1], 2).map(result => parseFloat(result.toFixed(2)));
Sorry, something went wrong.
25e596a
I fixed this by treating the decimal numbers as integers and convert them back to floats after all the computation are done
No branches or pull requests
Hi.
With such input:
Result is:
I was expecting to have just 2 numbers after the decimal point here.
The text was updated successfully, but these errors were encountered: