From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: Re: GMP code committed -- watch for bugs. Date: Thu, 24 Apr 2003 08:40:22 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87d6jcn8h5.fsf@zip.com.au> References: <87he9dhoxh.fsf@raven.i.defaultvalue.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1051137936 16532 80.91.224.249 (23 Apr 2003 22:45:36 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Apr 2003 22:45:36 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Apr 24 00:45:35 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 198Sz3-0004E9-00 for ; Thu, 24 Apr 2003 00:44:57 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 198SzB-0006T2-06 for guile-devel@m.gmane.org; Wed, 23 Apr 2003 18:45:05 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 198Syt-0006RN-00 for guile-devel@gnu.org; Wed, 23 Apr 2003 18:44:47 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 198Sw7-0005Od-00 for guile-devel@gnu.org; Wed, 23 Apr 2003 18:41:55 -0400 Original-Received: from snoopy.pacific.net.au ([61.8.0.36]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 198Sv0-00055i-00 for guile-devel@gnu.org; Wed, 23 Apr 2003 18:40:47 -0400 Original-Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.2.228.40]) h3NMeZFG015986 for ; Thu, 24 Apr 2003 08:40:36 +1000 Original-Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h3NMeZ0A019772 for ; Thu, 24 Apr 2003 08:40:35 +1000 (EST) Original-Received: from localhost (ppp11.dyn228.pacific.net.au [203.143.228.11]) by wisma.pacific.net.au (8.12.9/8.12.8) with ESMTP id h3NMeXGt002166 for ; Thu, 24 Apr 2003 08:40:34 +1000 (EST) Original-Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 198Sue-0001ZT-00; Thu, 24 Apr 2003 08:40:24 +1000 Original-To: guile-devel@gnu.org User-Agent: Gnus/5.090017 (Oort Gnus v0.17) Emacs/21.2 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2199 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2199 Rob Browning writes: > > There may well be bugs In >, < and =, mpz_cmp_d cannot be called with a NaN, that'll need to be tested explicitly. The doco doesn't say much about nans, but you can imagine with a positive/zero/negative return there's no scope to indicate "unordered". Also, unfortunately mpz_cmp_d currently doesn't recognise infinities, so those will need to be checked before making a call too. The current code ends up treating infinities as 2^1023 or some such big value, so the problem will only be seen with bignums larger than that. I'd been meaning to add infinities to mpz_cmp_d and friends, I'll see if that can be in gmp 4.2. In which case perhaps a bit of a macro like below (untested) to hide the difference between the versions, /* mpz_cmp_d only recognises infinities in gmp 4.2 and up. For prior versions use an explicit check here. */ #if __GNU_MP_VERSION < 4 \ || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR < 2) #define guile_mpz_cmp_d(z, d) \ (xisinf (d) ? (d < 0.0 ? 1 : -1) : mpz_cmp_d (z, d)) #else #define guile_mpz_cmp_d(z, d) mpz_cmp_d (z, d) #endif _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel