From 60d6e3fead4eca9e6da94d4a2a80ca196dc480c5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 13 Oct 2020 10:04:21 -0700 Subject: [PATCH] eql doc improvements * doc/lispref/numbers.texi (Comparison of Numbers): Copy some useful text from eql help string. * src/fns.c (Feql): In doc string, say that eql also compares integers by value. --- doc/lispref/numbers.texi | 4 ++++ src/fns.c | 1 + 2 files changed, 5 insertions(+) diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi index f018ef4c7c0..9a5bff5a5b2 100644 --- a/doc/lispref/numbers.texi +++ b/doc/lispref/numbers.texi @@ -450,6 +450,10 @@ numbers. It compares numbers by type and numeric value, so that @code{(eql 1.0 1)} returns @code{nil}, but @code{(eql 1.0 1.0)} and @code{(eql 1 1)} both return @code{t}. This can be used to compare large integers as well as small ones. +Floating-point values with the same sign, exponent and fraction are @code{eql}. +This differs from numeric comparison: @code{(eql 0.0 -0.0)} returns +@code{nil} and @code{(eql 0.0e+NaN 0.0e+NaN)} returns @code{t}, +whereas @code{=} does the opposite. @end defun @defun /= number-or-marker1 number-or-marker2 diff --git a/src/fns.c b/src/fns.c index 4003fe8a818..f50bf8ecb77 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2295,6 +2295,7 @@ The PLIST is modified by side effects. */) DEFUN ("eql", Feql, Seql, 2, 2, 0, doc: /* Return t if the two args are `eq' or are indistinguishable numbers. +Integers with the same value are `eql'. Floating-point values with the same sign, exponent and fraction are `eql'. This differs from numeric comparison: (eql 0.0 -0.0) returns nil and \(eql 0.0e+NaN 0.0e+NaN) returns t, whereas `=' does the opposite. */)