當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。