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
const NP = require("number-precision"); console.log(0.151 - 0.145);// 0.006000000000000005 console.log(NP.strip(0.151-0.145)); //0.00600000000000001
The text was updated successfully, but these errors were encountered:
function strip(num, precision=15) { return +parseFloat(Number(num).toPrecision(precision)); }
precision默认改成14,可以解决你的这个问题😂
Sorry, something went wrong.
function strip(num, precision=15) { return +parseFloat(Number(num).toPrecision(precision)); } precision默认改成14,可以解决你的这个问题😂
好的,感谢!!
请教一下,这种情况直接用精确减法是不是好一些 console.log(NP.minus(0.151,0.145));
No branches or pull requests
The text was updated successfully, but these errors were encountered: