Code like this makes me wonder why you didn't just right the whole thing as a binary expression. I'd need to see the table of values to be sure, but I would have thought it would be possible to write the entire thing without a single '||' or '&&' appearing.

I remember a "Fox Trot" comic strip in which Jason's teacher assigned the following problem: Farmer Jones has a rectangular field 100 feet wide and 200 feet long. What is the area of the field in square feet?

Jason uses calculus to find the area under the curve "y = 200" for the interval 0 <= x <= 100.

That's the first page of what he hands in. The next 99 pages are a proof that his method yielded the correct result.