1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-20 18:17:20 +00:00

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.
This commit is contained in:
Peder O. Klingenberg 2017-02-23 20:27:57 -05:00 committed by Glenn Morris
parent 8b912ab47b
commit f6d2ba74f8
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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