multModM

fun multModM(a: Double, s: Double, c: Double, m: Double): Double

Computes (a x s + c) mod m. Where m must be smaller than 2 to the 35. Works also if s or c are negative. The result is always positive (and thus always between 0 and m - 1).

Return

the result of the multiplication and the addition modulo m

Parameters

a

the first factor of the multiplication

s

the second factor of the multiplication

c

the second term of the addition

m

the modulus


fun multModM(a: Int, s: Int, c: Int, m: Int): Int
fun multModM(a: Long, s: Long, c: Long, m: Long): Long

Computes (a times s + c) mod m. Works also if s or c are negative. The result is always positive (and thus always between 0 and m - 1).

Return

the result of the multiplication and the addition modulo m

Parameters

a

the first factor of the multiplication

s

the second factor of the multiplication

c

the second term of the addition

m

the modulus