Open roadster31 opened 9 years ago
I'm reopening this issue, as the modulo (%) operator is casting its operands to integers, which may cause overflow if operands are > PHP_INT_MAX.
Example on a 32 bit machine, where PHP_INT_MAX = 2147483647 :
16748050000 % 1148700 =-1056684 ! (the proper result is 4000)
Using fmod() (floating point modulo) is not a proper solution, as floating point may cause a lost of precision on large numbers.
GCG::getGCD() uses is_int() to check if a number is an integer, but this function returns false if this number is greater than PHP_INT_MAX.