Skip to content

Instantly share code, notes, and snippets.

@ThaddeusJiang
Created May 9, 2019 10:36
Show Gist options
  • Save ThaddeusJiang/b549a933b798b49f48a1fca7aff42e31 to your computer and use it in GitHub Desktop.
Save ThaddeusJiang/b549a933b798b49f48a1fca7aff42e31 to your computer and use it in GitHub Desktop.
[easy buggy] JS float number problem
0.1 + 0.2 
> 0.30000000000000004

解决方法,整数没有这个问题,所以先变成整数,在运算。

复杂问题或者不想思考的时候,是可以使用 number-precision 解决。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment