Skip to content

Function: mod() ​

ts
function mod(a, b): number;

Remainder of a divided by b with fixed precision (sign follows dividend). 高精度取模(余数符号与被除数一致)。

Parameters ​

ParameterTypeDescription
anumberDividend / 被除数
bnumberDivisor / 除数

Returns ​

number

Remainder / 余数

Throws ​

Error if divisor is zero / 除数为零时抛出

Example ​

ts
mod(10.5, 3.1) // => 1.2

Since ​

1.0.0

Released under the MIT License.