Function mod [src]
Returns numerator modulo denominator, or an error if denominator is
zero or negative. Negative numerators never result in negative
return values.
Prototype
pub fn mod(comptime T: type, numerator: T, denominator: T) !T Parameters
T: typenumerator: Tdenominator: T Example
test mod {
try testMod();
try comptime testMod();
} Source
pub fn mod(comptime T: type, numerator: T, denominator: T) !T {
@setRuntimeSafety(false);
if (denominator == 0) return error.DivisionByZero;
if (denominator < 0) return error.NegativeDenominator;
return @mod(numerator, denominator);
}