aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2015-10-20 18:16:47 -0700
committerPaul Eggert2015-10-20 18:22:48 -0700
commite9af822ac3ddf9644aa4a68e56b0580e133449b2 (patch)
tree55b2ae836adac54903d43ee77e2730a0e2ac86bd /src
parent513fe25a501b41f9f2aac67f73c8e8730aed81b0 (diff)
downloademacs-e9af822ac3ddf9644aa4a68e56b0580e133449b2.tar.gz
emacs-e9af822ac3ddf9644aa4a68e56b0580e133449b2.zip
(/ N) now returns the reciprocal of N
This is more compatible with Common Lisp and XEmacs (Bug#21690). See: http://lists.gnu.org/archive/html/emacs-devel/2015-10/msg01053.html * lisp/color.el (color-hue-to-rgb, color-hsl-to-rgb) (color-xyz-to-srgb, color-xyz-to-lab): * lisp/emacs-lisp/cl-extra.el (cl-float-limits): * lisp/net/shr-color.el (shr-color-hue-to-rgb) (shr-color-hsl-to-rgb-fractions): Exploit the change to simplify the code a bit. * lisp/emacs-lisp/bytecomp.el (byte-compile-quo): Don’t complain about single-argument calls to ‘/’. * src/data.c (arith_driver, float_arith_driver): Implement the change.
Diffstat (limited to 'src')
-rw-r--r--src/data.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/data.c b/src/data.c
index b85d8a77106..33fe2855c99 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2603,6 +2603,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
2603 accum = 0; 2603 accum = 0;
2604 break; 2604 break;
2605 case Amult: 2605 case Amult:
2606 case Adiv:
2606 accum = 1; 2607 accum = 1;
2607 break; 2608 break;
2608 case Alogand: 2609 case Alogand:
@@ -2658,7 +2659,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
2658 accum *= next; 2659 accum *= next;
2659 break; 2660 break;
2660 case Adiv: 2661 case Adiv:
2661 if (!argnum) 2662 if (! (argnum || nargs == 1))
2662 accum = next; 2663 accum = next;
2663 else 2664 else
2664 { 2665 {
@@ -2727,7 +2728,7 @@ float_arith_driver (double accum, ptrdiff_t argnum, enum arithop code,
2727 accum *= next; 2728 accum *= next;
2728 break; 2729 break;
2729 case Adiv: 2730 case Adiv:
2730 if (!argnum) 2731 if (! (argnum || nargs == 1))
2731 accum = next; 2732 accum = next;
2732 else 2733 else
2733 { 2734 {
@@ -2782,9 +2783,11 @@ usage: (* &rest NUMBERS-OR-MARKERS) */)
2782} 2783}
2783 2784
2784DEFUN ("/", Fquo, Squo, 1, MANY, 0, 2785DEFUN ("/", Fquo, Squo, 1, MANY, 0,
2785 doc: /* Return first argument divided by all the remaining arguments. 2786 doc: /* Divide number by divisors and return the result.
2787With two or more arguments, return first argument divided by the rest.
2788With one argument, return 1 divided by the argument.
2786The arguments must be numbers or markers. 2789The arguments must be numbers or markers.
2787usage: (/ DIVIDEND &rest DIVISORS) */) 2790usage: (/ NUMBER &rest DIVISORS) */)
2788 (ptrdiff_t nargs, Lisp_Object *args) 2791 (ptrdiff_t nargs, Lisp_Object *args)
2789{ 2792{
2790 ptrdiff_t argnum; 2793 ptrdiff_t argnum;