The UnsignedMod
method computes the unsigned modulus of two floating-point numbers. This method is useful when you need to ensure that the result of a modulus operation is always non-negative, even if the dividend is negative.
The UnsignedMod
method computes the unsigned modulus of two floating-point numbers. This method is useful when you need to ensure that the result of a modulus operation is always non-negative, even if the dividend is negative.
To use the UnsignedMod
method, provide two float
values as parameters. The first parameter a
is the dividend, and the second parameter b
is the divisor. The method returns the remainder of the division of a
by b
, ensuring the result is non-negative.
float result = MathX.UnsignedMod(-5.5f, 3.0f); // result is 0.5f