[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master 37940b3: min and max now return one of their ar
Re: [Emacs-diffs] master 37940b3: min and max now return one of their arguments
Thu, 09 Mar 2017 18:10:46 +0200
> Cc: address@hidden, address@hidden
> From: Paul Eggert <address@hidden>
> Date: Wed, 8 Mar 2017 14:04:54 -0800
> On 03/08/2017 07:54 AM, Eli Zaretskii wrote:
> > Don't programmers
> > assume in general that comparisons between values some of which are
> > floats are always done after converting_all_ values to the
> > floating-point representation?
> No, and that hasn't been true for Emacs Lisp for quite some time. In
> Emacs 25, (<= 10000000000000001 10000000000000000 1e16) returns the
> mathematically-correct answer nil on a 64-bit GNU/Linux host even though
> it would return t if all values were first converted to float.
Not sure what that demonstrates, but I get
(<= 10000000000000001 1e16) => t
in Emacs 25.1 on a 64-bit GNU/Linux host.
> More generally, although people expect statically typed languages to
> convert alternatives to float (e.g., C programmers expect (1.5 > 2 ? 1.5
> : 2) to return 2.0 not 2), dynamically typed languages are different:
> Lisp programmers expect (if (> 1.5 2) 1.5 2) to return 2 not 2.0.
I'm not sure this is so, and anyway getting 2.0 should not matter in
> > I find the commentary in 'arithcompare' not detailed enough
> I installed the attached, which I hope helps.