this does not seem correct
left side is always positive, right side is always negative ...

additionally: using abs() would also allow distance ~1 to be valid (which should not be)