sub is_subpenny { my $number = abs ($_[0] * 100); return $number - int ($number) > 0; }
is faster by avoiding an extra multiply and also works for negative numbers although the abs may slow it down again.
In reply to Re: modulus and floating point numbers
by GrandFather
in thread modulus and floating point numbers
by dextius
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |