On 17 April 2014 02:08, Dave Nunn <[email protected]> wrote:
> The bug is presumably in the line:
> $max-- if $max %2;                   # Make the max odd
> as this does NOT force $max to be odd, but rather even.
> Not sure if the preferred rectification is:
> $max++ unless $max %2;
> -or-
> $max-- unless $max %2;
> though either works for the specific case of 3599.

Or why not replace the "if" clause with "if ($max % 2) == 0".

% is not a boolean operator, and I think that an explicit comparison
will make it clearer what exactly is being tested.

(I have similar feelings about people who write "if(strcmp(foo, bar))" in C.)

Cheers,
Philip
-- 
Philip Newton <[email protected]>
  • factor bug Dave Nunn
    • Re: factor bug Philip Newton

Reply via email to