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: Bruno Félix Rezende Ribeiro
Subject: Re: (- 2.8 1.6) ; 1.1999999999999997
Date: Tue, 07 Apr 2020 11:00:41 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hello Stefan,

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> 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.

I find this characterization a little bit misleading, and I know it’s
common jargon in computer science backed up by the specialized
literature and such, but I’d like to express my view on the matter.

Rigorously speaking there is no such thing as floating pointing
/numbers/ as there is no such thing as roman /numbers/ or even Arabic
decimal /numbers/.  All of those are /numerals/, that is, sequence of
symbols which represent (true) /numbers/.

All floating point numerals demonstrably represent rational numbers,
which are by definition also real numbers.  Therefore, Emacs support
arithmetic on some (finitely many) rational and real numbers.  Not all
rational numbers can be represented by floating point numerals, though.

Yet, all rational numbers can be represented by pairs of arbitrarily
large integers, which Emacs support (theoretically) by means of its
built-in Calc library.

Regarding irrational numbers, computers can faithfully represent any one
that is computable.  There are infinitely many of those (countably many,
still).  For instance, they may be represented by procedures that take
an arbitrarily large natural number =n= and outputs a rational number
that differs from the irrational number they represent in less than
=10^-n= units.  Being Lisp a Turing-complete language, Emacs can
represent all such real numbers.  To write an Emacs generalized real
number arithmetic package remains as an (exciting?) open exercise for
the free software community.

In my view and experience the rigor and distinctions I tried to convey
above make all the difference in truly understanding the Math-computer
and number-numeral dichotomy that seems to confuse so many programmers.


> 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.

Trivially, "decimal" floating point numerals (of sorts) would still be a
super-set of binary floating point numerals if independent integer
exponents were allowed for the denominator factors of 2 and 5.


-- 
Bruno Félix Rezende Ribeiro (oitofelix) [0x28D618AF]
<http://oitofelix.freeshell.org/>

Attachment: signature.asc
Description: PGP signature


reply via email to

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