help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: (- 2.8 1.6) ; 1.1999999999999997


From: Emanuel Berg
Subject: Re: (- 2.8 1.6) ; 1.1999999999999997
Date: Tue, 11 Feb 2020 02:55:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Stefan Monnier wrote:

>>     (- 2.8 1.6) ; 1.1999999999999997
>
> Emacs Lisp, like most common programming
> language doesn't support rational numbers
> (and even less real numbers, which can't be
> faithfully represented in a computer) but
> only floating point numbers. And like most
> programming languages it uses the standard
> IEEE representation supported natively by
> most CPUs. This representation can't
> represent 2.8 nor 1.6 (and nor 1.2) exactly.
>
> It so happens that "the representable number
> closest to 2.8" minus "the representable
> number closest to 1.6" is not equal to "the
> representable number closest to 1.2".
>
>> With the TI-84 Plus,
>>
>>     2.8-1.6=1.2
>
> IIUC those calculators used a decimal
> floating point representation, which suffers
> from the same kinds of problems of course,
> but works better in this specific case.

Sure seems like it :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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