]> git.eshelyaron.com Git - emacs.git/commitdiff
Make calc's least common multiple positive (bug#25255)
authorPeder O. Klingenberg <peder@klingenberg.no>
Fri, 24 Feb 2017 01:27:57 +0000 (20:27 -0500)
committerGlenn Morris <rgm@gnu.org>
Fri, 24 Feb 2017 01:28:40 +0000 (20:28 -0500)
* lisp/calc/calc-comb.el (calcFunc-lcm): Return absolute value.
* doc/misc/calc.texi (Combinatorial Functions): Update for the above.

doc/misc/calc.texi
lisp/calc/calc-comb.el

index baf46f7170340e903f31cf95e0fa6d0811debc1f..7bd060189c59a92c2d01fbef9be3805008d00b66 100644 (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
index bc1ac315a01a7e24f1ad7984e4521aa1831ce00b..c84ff236851bac4b9657800b52db3818d224a1ce 100644 (file)
 (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