Commit f6d2ba74 authored by Peder O. Klingenberg's avatar Peder O. Klingenberg Committed by Glenn Morris
Browse files

Make calc's least common multiple positive (bug#25255)

* lisp/calc/calc-comb.el (calcFunc-lcm): Return absolute value.
* doc/misc/calc.texi (Combinatorial Functions): Update for the above.
parent 8b912ab4
......@@ -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
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment