emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master f6d2ba7: Make calc's least common multiple positive


From: Glenn Morris
Subject: [Emacs-diffs] master f6d2ba7: Make calc's least common multiple positive (bug#25255)
Date: Thu, 23 Feb 2017 20:28:57 -0500 (EST)

branch: master
commit f6d2ba74f80b9a055a3d8072d49475aec45c2dbe
Author: Peder O. Klingenberg <address@hidden>
Commit: Glenn Morris <address@hidden>

    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.
---
 doc/misc/calc.texi     | 4 ++--
 lisp/calc/calc-comb.el | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index baf46f7..7bd0601 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}) address@hidden 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 bc1ac31..c84ff23 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]