diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index baf46f71703..7bd060189c5 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -19111,8 +19111,8 @@ the operation is left in symbolic form. @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 diff --git a/lisp/calc/calc-comb.el b/lisp/calc/calc-comb.el index bc1ac315a01..c84ff236851 100644 --- a/lisp/calc/calc-comb.el +++ b/lisp/calc/calc-comb.el @@ -260,7 +260,7 @@ (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