[Top][All Lists]

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

Re: Making 'eq' == 'eql' in bignum branch

From: Stefan Monnier
Subject: Re: Making 'eq' == 'eql' in bignum branch
Date: Fri, 31 Aug 2018 17:15:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

I don't have any opinion on whether infinities should be called numbers
or not, but regarding:

> There have been discussions about the Lisp functions max and min being
> called without arguments.  Some people have advocated that non-numbers
> be returned in such cases.  I request most earnestly that this is not
> done.  Callers of these functions have a right to assume that returned
> results are mathematically correct and that they can do arithmetic with
> them.

Currently many arithmetic functions, when called with "non-numbers" do
not signal an error, but instead return another such "non-number".
E.g. (+ 1.0e+INF 1) returns 1.0e+INF.
This is considered normal according to the IEEE practice.

So, from that point of view, I think it's fairly normal for min/max to
follow the same practice and return some kind of non-number when called
with another non-number, and by extension when not called with a number.

This non-number result (e.g. 1.0e+INF for `min`) can very be considered
as "returning an error" (just not using Elisp's error handling system,
but using IEEE's NaNs instead).


PS: I prefer to stay away from anything past the Z set of numbers, and
I think anything involving floats will inevitably suck in corner cases,
so any behavior you choose in that case is OK AFAIC ;-)

reply via email to

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