-
-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
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
NumUtil.divide 存在的问题 #47
Comments
3.14 / 180 也会出现这样的问题。 貌似只要小数点比较多就会出现: |
是无理数的情况下,才会出现 |
找到解决方案了么 |
我想你可以自己去重写除的方法,去加上 double divide(num? num1, num? num2, {int? scaleOnInfinitePrecision) {
final Rational value = Decimal.parse(num1.toString()) / Decimal.parse(num2.toString());
return value
.toDecimal(scaleOnInfinitePrecision: scaleOnInfinitePrecision)
.toDouble();
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NumUtil.divide
方法,当a/b = 1/3
时,报错信息如下:
使用
toDecimal()
方法需要添加scaleOnInfinitePrecision
参数The text was updated successfully, but these errors were encountered: