Function rem [src]

Returns the remainder when numerator is divided by denominator, or an error if denominator is zero or negative. Negative numerators can give negative results.

Prototype

pub fn rem(comptime T: type, numerator: T, denominator: T) !T

Parameters

T: typenumerator: Tdenominator: T

Example

test rem { try testRem(); try comptime testRem(); }

Source

pub fn rem(comptime T: type, numerator: T, denominator: T) !T { @setRuntimeSafety(false); if (denominator == 0) return error.DivisionByZero; if (denominator < 0) return error.NegativeDenominator; return @rem(numerator, denominator); }