positiveMod static method
Calculates the positive remainder of two BigInt values.
This function takes two BigInt values, a and b, and computes a % b.
If the result is greater than or equal to zero, it returns the result.
If the result is negative, it adds b to the result to make it positive.
Parameters: a (BigInt): The dividend. b (BigInt): The divisor.
Returns:
BigInt: The positive remainder of a when divided by b.
Implementation
static BigInt positiveMod(BigInt a, BigInt b) {
final result = a % b;
return result >= BigInt.zero ? result : b + result;
}