* lisp/calc/calc-comb.el (calcFunc-lcm): Return absolute value.
* doc/misc/calc.texi (Combinatorial Functions): Update for the above.
@tindex lcm
The @kbd{k l} (@code{calc-lcm}) [@code{lcm}] command computes the
Least Common Multiple of two integers or fractions. The product of
-the LCM and GCD of two numbers is equal to the product of the
-numbers.
+the LCM and GCD of two numbers is equal to the absolute value of the
+product of the numbers.
@kindex k E
@pindex calc-extended-gcd
(defun calcFunc-lcm (a b)
(let ((g (calcFunc-gcd a b)))
(if (Math-numberp g)
- (math-div (math-mul a b) g)
+ (math-div (math-abs (math-mul a b)) g)
(list 'calcFunc-lcm a b))))
(defun calcFunc-egcd (a b) ; Knuth section 4.5.2