Substitute number equivalents when comparing to booleans
Merge pull request #539 from pauldraper/optimize-boolean-comparison

Substitute number equivalents when comparing to booleans