10 lines
142 B
Plaintext
10 lines
142 B
Plaintext
|
function mod_negative(val, modval) {
|
||
|
if val < 1 {
|
||
|
while val < 0 {
|
||
|
val += modval;
|
||
|
}
|
||
|
return val;
|
||
|
} else {
|
||
|
return val % modval;
|
||
|
}
|
||
|
}
|