Yes, originally, the code stopped searching when it found the first reduction. Given the order in which these are searched, it didn't produce this garbage. I only changed this behavior before pasting the code, because it may be interesting to see multiple possibilities (like with E(21/32) = E(3/4) & E(7/8) = E(1/2) | E(5/16)), and I didn't notice the noise.
To fix it, change
if ($denominator2 > $numerator2) {
to
if ($denominator1 > $numerator1 && $denominator2 > $numerator2) {
but I'm sure you know that.
In reply to Re^7: Boolean math: Fill in the blanks.
by pjotrik
in thread Boolean math: Fill in the blanks.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |