I have this PHP code:
$entityElementCount = (-($highScore-$totalKeywordCount))/0.29;
What i want to know is, how to check whether $
What seems a simple approach would be to use modulus (%) to determine if a value is whole or not.
x = y % 1
if y is anything other then a whole number the result is not a zero (0). A test then would be:
if (y % 1 == 0) {
// this is a whole number
} else {
// this is not a whole number
}
var isWhole = (y % 1 == 0? true: false); // to get a boolean return.
Granted this will view a negative number as a whole number, then then just wrap ABS() around y to always test on the positive.