From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Zefram Newsgroups: gmane.lisp.guile.bugs Subject: bug#16365: (* 0 +inf.0) rationale is flawed Date: Mon, 6 Jan 2014 00:17:19 +0000 Message-ID: <20140106001719.GI21945@fysh.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1388967683 19270 80.91.229.3 (6 Jan 2014 00:21:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 6 Jan 2014 00:21:23 +0000 (UTC) To: 16365@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Jan 06 01:21:29 2014 Return-path: Envelope-to: guile-bugs@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 1Vzxwa-0004n3-Vy for guile-bugs@m.gmane.org; Mon, 06 Jan 2014 01:21:25 +0100 Original-Received: from localhost ([::1]:59933 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vzxwa-0006Jj-AE for guile-bugs@m.gmane.org; Sun, 05 Jan 2014 19:21:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzxtO-00047I-HN for bug-guile@gnu.org; Sun, 05 Jan 2014 19:18:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VzxtK-0001kx-B5 for bug-guile@gnu.org; Sun, 05 Jan 2014 19:18:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51524) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzxtK-0001kl-7v for bug-guile@gnu.org; Sun, 05 Jan 2014 19:18:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VzxtJ-000748-R1 for bug-guile@gnu.org; Sun, 05 Jan 2014 19:18:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Zefram Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 06 Jan 2014 00:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16365 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138896745327118 (code B ref -1); Mon, 06 Jan 2014 00:18:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Jan 2014 00:17:33 +0000 Original-Received: from localhost ([127.0.0.1]:37310 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vzxsq-00073J-Lm for submit@debbugs.gnu.org; Sun, 05 Jan 2014 19:17:33 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54758) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vzxso-00073B-Gm for submit@debbugs.gnu.org; Sun, 05 Jan 2014 19:17:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vzxsn-0001ed-Dh for submit@debbugs.gnu.org; Sun, 05 Jan 2014 19:17:30 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:41153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vzxsn-0001eZ-9o for submit@debbugs.gnu.org; Sun, 05 Jan 2014 19:17:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vzxsm-00045I-4J for bug-guile@gnu.org; Sun, 05 Jan 2014 19:17:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vzxsl-0001dL-CK for bug-guile@gnu.org; Sun, 05 Jan 2014 19:17:28 -0500 Original-Received: from river.fysh.org ([2001:41d0:8:d47f::2]:52604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vzxsl-0001d0-5m for bug-guile@gnu.org; Sun, 05 Jan 2014 19:17:27 -0500 Original-Received: from zefram by river.fysh.org with local (Exim 4.80 #2 (Debian)) id 1Vzxsd-0002kF-SG; Mon, 06 Jan 2014 00:17:19 +0000 Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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-Mailman-Approved-At: Sun, 05 Jan 2014 19:21:12 -0500 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7370 Archived-At: Commit 5e7918077a4015768a352ab19e4a8e94531bc8aa says A note on the rationale for (* 0 +inf.0) being a NaN and not exact 0: The R6RS requires that (/ 0 0.0) return a NaN value, and that (/ 0.0) return +inf.0. We would like (/ x y) to be the same as (* x (/ y)), This identity doesn't actually hold. For example, on guile 2.0.9 with IEEE double flonums: scheme@(guile-user)> (/ (expt 2.0 -20) (expt 2.0 -1026)) $36 = 6.857655085992111e302 scheme@(guile-user)> (* (expt 2.0 -20) (/ (expt 2.0 -1026))) $37 = +inf.0 This case arises because the dynamic range of this flonum format is slightly asymmetric: 2^-1026 is representable, but 2^1026 overflows. So the rationale for (* 0 +inf.0) yielding +nan.0 is flawed. As the supposed invariant and the rationale are not in the actual documentation (only mentioned in the commit log) this is not necessarily a bug. But worth thinking again to determine whether the case for adopting the flonum behaviour here is still stronger than the obvious case for the exact zero to predominate. (Mathematically, multiplying zero by an infinite number does yield zero. Let alone multiplying it by a merely large finite number, which is what the flonum indefinite `infinity' really represents.) -zefram