当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Dart BigInt.operator_divide用法及代码示例


dart:core 库中BigInt.operator_divide 方法的用法介绍如下。

用法:

double operator /(
   BigInt other   
)

双除法运算符。

匹配 int 上的类似运算符,此操作首先对这个大整数和 other 执行 toDouble,然后对这些值执行 double.operator/ 并返回结果。

注意:初始toDouble 转换可能会丢失精度。

例子:

print(BigInt.from(1) / BigInt.from(2)); // 0.5
print(BigInt.from(1.99999) / BigInt.from(2)); // 0.5

相关用法


注:本文由纯净天空筛选整理自dart.dev大神的英文原创作品 operator / method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。