Why is it that when I run this script
<?php die("600851475143 mod 3 = " . 600851475143 % 3); ?>
it returns this output
600851475143 mod 3 = 0 and when I perform the math operator 600851475143 / 3 on my Windows calculator I’m given the answer 200283825047.66666666666666666667
Obviously there IS a remainder. So why does PHP not see it?
PS - Is it just me?
The number is too large.
2^32 -> 4,294,967,296 Your number -> 600,851,475,143
You may have to use http://www.php.net/manual/en/book.gmp.php
http://www.php.net/manual/en/function.bcmod.php
Although PHP generally handles data types for you, in this case - you can’t do standard math because the number is too large.
There’s a function for that™, you can use bc_____ functions to do the math.
Thanks for the responses. I feel less crazy already.
[edit] bcmod worked great, thx