From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.devel Subject: Re: IEEE Inf and NaN support for numbers.c Date: 07 May 2002 00:39:25 +0200 Sender: guile-devel-admin@gnu.org Message-ID: <87sn54dhpe.fsf@zagadka.ping.de> References: <15494.39950.119995.223196@segfault.bogus.domain> <87lmcuyifu.fsf@zagadka.ping.de> <15514.19909.408835.204209@segfault.bogus.domain> <87g01koqrs.fsf@zagadka.ping.de> <15559.7841.142286.603654@segfault.bogus.domain> <87662gd8zz.fsf@zagadka.ping.de> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1020734162 32280 127.0.0.1 (7 May 2002 01:16:02 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 7 May 2002 01:16:02 +0000 (UTC) Cc: guile-devel Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 174taD-0008OH-00 for ; Tue, 07 May 2002 03:16:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 174sv8-00014f-00; Mon, 06 May 2002 20:33:34 -0400 Original-Received: from dialin.speedway42.dip244.dokom.de ([195.138.42.244] helo=zagadka.ping.de) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 174r8h-0007nl-00 for ; Mon, 06 May 2002 18:39:27 -0400 Original-Received: (qmail 25373 invoked by uid 1000); 6 May 2002 22:39:25 -0000 Original-To: "John W. Eaton" In-Reply-To: <87662gd8zz.fsf@zagadka.ping.de> Original-Lines: 54 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:581 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:581 Marius Vollmer writes: > Ok. I think we should follow PLT Scheme here. I will apply your > patch and make the necessary changes. Done. Please play with it and tell me whether you like the changes I made. numbers.c (mem2ureal): Recognize "inf.0" and "nan.xxx". (scm_even_p, scm_odd_p): Treat infinity as even and odd. (iflo2str): Don't output a '+' for negative numbers or for Inf and NaN. They will provide their own sign. (scm_divide): Only allow divides by inexact zeros. Dividing by exact zeros still signals an errors. Here is the NEWS entry: ** There is support for Infinity and NaNs. Following PLT Scheme, Guile can now work with infinite numbers and 'not-a-numbers'. There is new syntax for numbers: "+inf.0" (infinity), "-inf.0" (negative infinity), "+nan.0" (not-a-number), and "-nan.0" (same as "+nan.0"). These numbers are inexact and have no exact counterpart. Dividing by an inexact zero returns +inf.0 or -inf.0, depending on the sign of the dividend. The infinities are integers, and they answer #t for both 'even?' and 'odd?'. The +nan.0 value is not an integer and is not '=' to itself, but '+nan.0' is 'eqv?' to itself. For example (/ 1 0.0) => +inf.0 (/ 0 0.0) => +nan.0 (/ 0) ERROR: Numerical overflow PLT Scheme does also distinguish plus and minus zero: (= 0.0 -0.0) => #t but (eqv? 0.0 -0.0) => #f I think we should do this as well. John, how would one test for the sign of zero? _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel