Fixed an error in computing gcd and lcm for some extreme values at integer range boundaries. JIRA: MATH-243