all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Bruno Félix Rezende Ribeiro" <oitofelix@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: help-gnu-emacs@gnu.org
Subject: Re: (- 2.8 1.6) ; 1.1999999999999997
Date: Tue, 07 Apr 2020 11:00:41 -0300	[thread overview]
Message-ID: <87ftdfwg3a.fsf@oitofelix.com> (raw)
In-Reply-To: <jwvftfhrk7b.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 10 Feb 2020 20:31:56 -0500")

[-- Attachment #1: Type: text/plain, Size: 2495 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 454 bytes --]

      parent reply	other threads:[~2020-04-07 14:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10 21:18 (- 2.8 1.6) ; 1.1999999999999997 Emanuel Berg via Users list for the GNU Emacs text editor
2020-02-10 21:31 ` tomas
2020-02-10 21:33 ` Joost Kremers
2020-02-10 23:10   ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-02-11  1:31 ` Stefan Monnier
2020-02-11  1:50   ` Alexandre François Garreau
2020-02-11  1:55   ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-04-07 14:00   ` Bruno Félix Rezende Ribeiro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ftdfwg3a.fsf@oitofelix.com \
    --to=oitofelix@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.