Add more documentation for Mod() (#1735)

directional-lights
Lukas Werling 2016-05-01 19:49:20 +02:00
parent 4f9d8afa93
commit c9aa07ee60
1 changed files with 8 additions and 2 deletions

View File

@ -162,8 +162,14 @@ global func GetSurfaceVector(int x, int y)
return normal;
}
// Proper modulo operation.
global func Mod(a, b)
// Mathematical modulo operation for calculations in /n.
//
// Examples:
// (12 % 10) == Mod(12, 10) == 2
// (-1 % 10) == -1
// Mod(-1, 10) == 9
global func Mod(int dividend, int divisor)
{
var a = dividend, b = divisor;
return (a % b + b) % b;
}