I've this PHP function which does not work for negative numbers:
function isOdd($num)
{
return $num % 2 == 1;
}
but it works for positive number.
I have this Perl routine which does the exact same thing and works for negative number also
sub isOdd()
{
my ($num) = @_;
return $num % 2 == 1;
}
Did I make any mistake in translating the function ? or is it PHP bug ?