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


Dart BigInt.remainder用法及代码示例


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

用法:

BigInt remainder(
   BigInt other   
)

返回 this 除以 other 的余数。

此操作的结果 r 满足:this == (this ~/ other) * other + r 。因此,余数 r 与除法器 this 具有相同的符号。

例子:

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

相关用法


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