Thread View: perl.ppt
1 messages
1 total messages
Started by Philip Newton
Sat, 19 Apr 2014 09:12
Re: factor bug
Author: Philip Newton
Date: Sat, 19 Apr 2014 09:12
Date: Sat, 19 Apr 2014 09:12
21 lines
2789 bytes
2789 bytes
On 17 April 2014 02:08, Dave Nunn <david.s.nunn@gmail.com> 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 <philip.newton@gmail.com>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads