So I understand that FMOD
gives some wacky answers sometimes because its sort of approximate.
But even given that I'm struggling to utilize the answers it throws up later-on in the code.
For instance, fmod(16,1.6)
gives us 1.6 rather than 0, that's fine. In the following code, echoing $goodfit
prints 1.6 but hurray doesn't print.
$getLength = 16;
$goodFit = fmod($getLength, 1.6);
echo $goodFit;
if ($goodFit === 1.6){
echo hurray;
}
I've tried double equation signs instead of triple incase it was a data type problem and I've tried rounding the $goodfit
equation to one decimal place.
All seems a little odd. I'm just trying to make a bit of code that triggers if a division was exact.