From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#19025: 24.4; precision error when adding two floats Date: Tue, 11 Nov 2014 21:06:35 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415758047 1139 80.91.229.3 (12 Nov 2014 02:07:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Nov 2014 02:07:27 +0000 (UTC) Cc: 19025-done@debbugs.gnu.org To: "Kevin W. Currey" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 12 03:07:16 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XoNL1-0003js-SM for geb-bug-gnu-emacs@m.gmane.org; Wed, 12 Nov 2014 03:07:16 +0100 Original-Received: from localhost ([::1]:52120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoNL1-0004mH-3a for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Nov 2014 21:07:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoNKx-0004mC-6W for bug-gnu-emacs@gnu.org; Tue, 11 Nov 2014 21:07:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoNKp-0001y0-DF for bug-gnu-emacs@gnu.org; Tue, 11 Nov 2014 21:07:11 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoNKp-0001xv-AR for bug-gnu-emacs@gnu.org; Tue, 11 Nov 2014 21:07:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XoNKp-0005ED-0m for bug-gnu-emacs@gnu.org; Tue, 11 Nov 2014 21:07:03 -0500 Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Nov 2014 02:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 19025 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Mail-Followup-To: 19025@debbugs.gnu.org, monnier@iro.umontreal.ca, kevalier68@hotmail.com Original-Received: via spool by 19025-done@debbugs.gnu.org id=D19025.141575799920023 (code D ref 19025); Wed, 12 Nov 2014 02:07:02 +0000 Original-Received: (at 19025-done) by debbugs.gnu.org; 12 Nov 2014 02:06:39 +0000 Original-Received: from localhost ([127.0.0.1]:57995 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XoNKQ-0005Cp-Ut for submit@debbugs.gnu.org; Tue, 11 Nov 2014 21:06:39 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:19082) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XoNKO-0005Cc-BN; Tue, 11 Nov 2014 21:06:36 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvAMAOatTlRLd+sd/2dsb2JhbABcgw6DYoZ+yDmDGgQCAoEcFwEBfIQDAQEEViMQCzQSFBgNJIhUy3IBAQEBAQEEAQEBAR6RCAeESwWLZKY8gW+EFh+CegEBAQ X-IPAS-Result: AvAMAOatTlRLd+sd/2dsb2JhbABcgw6DYoZ+yDmDGgQCAoEcFwEBfIQDAQEEViMQCzQSFBgNJIhUy3IBAQEBAQEEAQEBAR6RCAeESwWLZKY8gW+EFh+CegEBAQ X-IronPort-AV: E=Sophos;i="5.04,797,1406606400"; d="scan'208";a="96683190" Original-Received: from 75-119-235-29.dsl.teksavvy.com (HELO pastel.home) ([75.119.235.29]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 11 Nov 2014 21:06:35 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 96A78848C; Tue, 11 Nov 2014 21:06:35 -0500 (EST) In-Reply-To: (Kevin W. Currey's message of "Tue, 11 Nov 2014 19:36:39 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:95894 tags 19025 notabug thanks > (message "%s" (+ 379.744 57.93)) > The above prints 437.67400000000004. That's the difference between floating-point numbers and real or rational numbers. > (message "%s" (format "%f" (+ 379.744 57.93))) You can cut the middle man: (message "%f" (+ 379.744 57.93)) But note that this prints something "incorrect": M-: (message "%f" (+ 379.744 57.93)) => 437.674000. M-: (equal (+ 379.744 57.93) 437.674000) => nil It's just that %f rounds differently. Stefan