From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Aubrey Jaffer Newsgroups: gmane.lisp.guile.bugs Subject: Re: bug in eqv? Date: Thu, 23 Mar 2006 19:17:53 -0500 (EST) Message-ID: <20060324001753.623721B77C9@home.voluntocracy.org> References: <20060318034255.6DF6E1B77C9@home.voluntocracy.org> <87mzfkd36j.fsf@zip.com.au> <87acbjs6d3.fsf@minimini.mvo.home> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1143208617 15464 80.91.229.2 (24 Mar 2006 13:56:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Mar 2006 13:56:57 +0000 (UTC) Cc: bug-guile@gnu.org, user42@zip.com.au Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Mar 24 14:56:53 2006 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FMmm6-0006vZ-9x for guile-bugs@m.gmane.org; Fri, 24 Mar 2006 14:56:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FMmm1-0003Nt-BB for guile-bugs@m.gmane.org; Fri, 24 Mar 2006 08:56:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FMZyg-0001cl-OC for bug-guile@gnu.org; Thu, 23 Mar 2006 19:16:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FMZyf-0001cX-Fj for bug-guile@gnu.org; Thu, 23 Mar 2006 19:16:29 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FMZyf-0001cU-Bn for bug-guile@gnu.org; Thu, 23 Mar 2006 19:16:29 -0500 Original-Received: from [204.127.192.82] (helo=rwcrmhc12.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FMZzM-0005Iq-HN for bug-guile@gnu.org; Thu, 23 Mar 2006 19:17:12 -0500 Original-Received: from mail.voluntocracy.org (voluntocracy.org[24.147.9.238]) by comcast.net (rwcrmhc12) with ESMTP id <20060324001617m1200jdreje>; Fri, 24 Mar 2006 00:16:18 +0000 Original-Received: from home.voluntocracy.org (aubrey.jaffer [192.168.1.252]) by mail.voluntocracy.org (Postfix) with ESMTP id 3524B335C1; Thu, 23 Mar 2006 19:14:16 -0500 (EST) Original-Received: by home.voluntocracy.org (Postfix, from userid 500) id 623721B77C9; Thu, 23 Mar 2006 19:17:53 -0500 (EST) Original-To: mvo@zagadka.de In-reply-to: <87acbjs6d3.fsf@minimini.mvo.home> (message from Marius Vollmer on 22 Mar 2006 01:52:40 +0200) X-Mailman-Approved-At: Fri, 24 Mar 2006 08:56:12 -0500 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:3220 Archived-At: | From: Marius Vollmer | Date: 22 Mar 2006 01:52:40 +0200 | | Kevin Ryde writes: | | > Aubrey Jaffer writes: | > > | > > Because (= 0.0 -0.0) is #t, (eqv? 0.0 -0.0) must be #t. | > | > Ah dear, thanks. Bit too much creativity with the nans and infs. | | Hmm. I think SRFI 77 (Preliminary Proposal for R6RS Arithmetic) would | require (eqv? 0.0 -0.0) => #f, since it says | | The eqv? procedure returns #f if obj1 and obj2 yield different | results (in the sense of eqv?) when passed as arguments to any | other procedure that can be defined as a finite composition of | Scheme's standard arithmetic procedures. | | and, for example, (eqv? (flatan2 -1.0 -0.0) (flatan2 1.0 -0.0)) => #f. | See also "Lucier's Proposal" in the SRFI 77 document. SRFI-77 is the most preliminary of proposals, and guaranteed to be withdrawn. If you are determined that Guile chase SRFI phantoms, then be sure to note this variance from R4RS and R5RS in the documentation. | I originally copied the behavior of PLT Scheme http://swiss.csail.mit.edu/~jaffer/III/RAWI shows that there are many differences in implementations' numerical behavior. One could justify nearly any choice if the act of copying were, in itself, a justification. | and I'd say it is OK to follow SRFI 77 for the behavior of negative | zero, infinities and NaNs now that it exists. bash-2.05b$ mzscheme Welcome to MzScheme version 209, Copyright (c) 2004 PLT Scheme, Inc. > (eqv? -0.0 0.0) #t bash-2.05b$ mzscheme-301 Welcome to MzScheme version 301, Copyright (c) 2004-2005 PLT Scheme Inc. > (eqv? -0.0 0.0) #f > (equal? -0.0 0.0) #f bash-2.05b$ guile guile> (eqv? -0.0 0.0) #f guile> (equal? -0.0 0.0) #t SRFI-77 does not mention equal?, so R5RS would still be in effect: -- library procedure: equal? obj1 obj2 `Equal?' recursively compares the contents of pairs, vectors, and strings, applying `eqv?' on other objects such as numbers and symbols. A rule of thumb is that objects are generally `equal?' if they print the same. `Equal?' may fail to terminate if its arguments are circular data structures. If -0.0 and 0.0 print differently, then there is no support for (equal? -0.0 0.0) ==> #t. | (We get (integer? +inf.0) => #f wrong, then, and probably other | things.) Mzscheme also does (integer? +inf.0) ==> #t. Does that make it right? _______________________________________________ Bug-guile mailing list Bug-guile@gnu.org http://lists.gnu.org/mailman/listinfo/bug-guile