From: "Kevin W. Currey" <kevalier68@hotmail.com>
To: 19025@debbugs.gnu.org
Subject: bug#19025: 24.4; precision error when adding two floats
Date: Tue, 11 Nov 2014 19:36:39 -0500 [thread overview]
Message-ID: <BLU173-W24D13BED05558CB0C7562CCA8E0@phx.gbl> (raw)
[-- Attachment #1: Type: text/plain, Size: 3368 bytes --]
(message "%s" (+ 379.744 57.93))
The above prints 437.67400000000004. Same if I use 57.930, but if I use 57.931 (below) I get the correct answer 437.675.
(message "%s" (+ 379.744 57.931))
I was able to work around by using format:
(message "%s" (format "%f" (+ 379.744 57.93)))
which prints 437.674000.
FYI, I can replicate the issue with Emacs 21.3.1.
Thanks,
-Kevin
In GNU Emacs 24.4.1 (x86_64-unknown-cygwin)
of 2014-10-21 on desktop-new
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure
--srcdir=/home/kbrown/src/cygemacs/emacs-24.4-1.x86_64/src/emacs-24.4
--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var
--sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share
--docdir=/usr/share/doc/emacs --htmldir=/usr/share/doc/emacs/html -C
--with-w32 --without-file-notification --enable-checking 'CFLAGS=-ggdb
-O2 -pipe -Wimplicit-function-declaration -Og -g3
-fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-24.4-1.x86_64/build=/usr/src/debug/emacs-24.4-1
-fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-24.4-1.x86_64/src/emacs-24.4=/usr/src/debug/emacs-24.4-1'
CPPFLAGS= LDFLAGS='
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Fundamental
Minor modes in effect:
shell-dirtrack-mode: t
display-time-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
line-number-mode: t
Recent messages:
Load-path shadows:
None found.
Features:
(pp shadow sort gnus-util mail-extr emacsbug message format-spec rfc822
mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils info find-func grep tabify sh-script smie
executable shell pcomplete compile comint ansi-color ring dabbrev
cc-langs cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs arc-mode archive-mode dired-aux ispell apropos
dired help-fns help-mode easymenu mule-util server edmacro kmacro
cl-loaddefs cl-lib time jka-compr time-date tooltip electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel w32-common-fns disp-table
w32-win w32-vars tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind w32 multi-tty emacs)
Memory information:
((conses 16 145217 10616)
(symbols 48 23227 0)
(miscs 40 133 446)
(strings 32 31064 5702)
(string-bytes 1 930985)
(vectors 16 15771)
(vector-slots 8 452262 7494)
(floats 8 82 775)
(intervals 56 640 31)
(buffers 960 24))
[-- Attachment #2: Type: text/html, Size: 4016 bytes --]
next reply other threads:[~2014-11-12 0:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 0:36 Kevin W. Currey [this message]
2014-11-12 1:38 ` bug#19025: 24.4; precision error when adding two floats Alexis
2014-11-12 2:28 ` Jay Belanger
2014-11-12 2:42 ` Alexis
2014-11-12 2:06 ` Stefan Monnier
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BLU173-W24D13BED05558CB0C7562CCA8E0@phx.gbl \
--to=kevalier68@hotmail.com \
--cc=19025@debbugs.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).