if lcm is undefined for zero, tests in this case must be avoided