From: Teemu Likonen <tlikonen@iki.fi>
To: help-gnu-emacs@gnu.org
Subject: Re: (+ 5.1 0.1)
Date: Mon, 13 Jul 2009 15:59:10 +0300 [thread overview]
Message-ID: <87hbxg3fj5.fsf@iki.fi> (raw)
In-Reply-To: 874otgdb9q.wl%anselm.helbig+news2009@googlemail.com
On 2009-07-13 14:21 (+0200), Anselm Helbig wrote:
> This is a fundamental problem with floating point numbers, something
> similar happens in python:
>
> Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
> [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> 5.1 + 0.1
> 5.1999999999999993
Thanks for info. This is new to me too as I don't know much about
floating point numbers. For that particular example CLISP, a Common Lisp
implementation, gives the correct result:
$ clisp -q -norc -x '(+ 5.1 0.1)'
5.2
Emacs' arbitrary-precision calculator gives 5.2 too:
(calc-eval "5.1 + 0.1")
=> "5.2"
> http://www.theregister.co.uk/2006/08/12/floating_point_approximation/
> http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
I'll certainly study these.
next prev parent reply other threads:[~2009-07-13 12:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-13 10:57 (+ 5.1 0.1) leonut
2009-07-13 12:21 ` Anselm Helbig
2009-07-13 12:59 ` Teemu Likonen [this message]
2009-07-13 13:31 ` leonut
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=87hbxg3fj5.fsf@iki.fi \
--to=tlikonen@iki.fi \
--cc=help-gnu-emacs@gnu.org \
/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.