in reply to if logic OR parentheses problem

Ellhar:

It looks like you're overcomplicating things. By looking over your code, it looks like you really want something like this (untested!):

$a= 20; $b= 22.5; $c= 23 $atob = abs($a - $b) > 1 ? 1 : 0; $btoc = abs($b - $c) > 1 ? 1 : 0; $atoc = abs($a - $c) > 1 ? 1 : 0; if ( $atob && $atoc && $btoc ) { print OUTFILE "DIFF > 1 all three\n"; $matrixflags[$row - 4][$i] = 1; $matrixflags[$row - 3][$i] = 1; $matrixflags[$row - 2][$i] = 1; } ...
That would also help you avoid some of the impossible conditions in your code, like:

((btoc < 1) && (btoc > -1))
You should always try to simplify your logic before writing your code!

...roboticus

Update: After another second of thought, perhaps this would be even more to your liking--Replace the if .. then stuff with:

if ($atob+$atoc+$btoc) { printf OUTFILE "DIFF=%d: %f, %f, %f\n", $atob+$atoc+$btoc, $a-$b, $a-$c, $b-$c; } $matrixflags[$row - 4][$i] = $atob; $matrixflags[$row - 3][$i] = $atoc; $matrixflags[$row - 2][$i] = $atob; }