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


Dart BigInt.operator_modulo用法及代碼示例

dart:core 庫中BigInt.operator_modulo 方法的用法介紹如下。

用法:

BigInt operator %(
   BigInt other   
)

歐幾裏得模運算符。

返回歐幾裏得除法的餘數。兩個整數 ab 的歐幾裏得除法產生兩個整數 qr 使得 a == b * q + r0 <= r < b.abs()

返回值r 的符號始終為正。

有關截斷除法的其餘部分,請參見remainder

例子:

print(BigInt.from(5) % BigInt.from(3)); // 2
print(BigInt.from(-5) % BigInt.from(3)); // 1
print(BigInt.from(5) % BigInt.from(-3)); // 2
print(BigInt.from(-5) % BigInt.from(-3)); // 1

相關用法


注:本文由純淨天空篩選整理自dart.dev大神的英文原創作品 operator % method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。