From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mikael Djurfeldt Newsgroups: gmane.lisp.guile.devel Subject: Re: GMP code committed -- watch for bugs. Date: Sun, 06 Apr 2003 11:23:01 +0200 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: References: <87he9dhoxh.fsf@raven.i.defaultvalue.org> Reply-To: djurfeldt@nada.kth.se NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1049621149 27569 80.91.224.249 (6 Apr 2003 09:25:49 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 6 Apr 2003 09:25:49 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Apr 06 11:25:48 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 1926PM-0007AW-00 for ; Sun, 06 Apr 2003 11:25:48 +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 1926Nn-0008T9-00 for guile-devel@m.gmane.org; Sun, 06 Apr 2003 05:24:11 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 1926Mx-0007hL-00 for guile-devel@gnu.org; Sun, 06 Apr 2003 05:23:19 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 1926Mr-0007Yj-00 for guile-devel@gnu.org; Sun, 06 Apr 2003 05:23:13 -0400 Original-Received: from kvast.blakulla.net ([213.212.20.77]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 1926Mi-0007Ix-00 for guile-devel@gnu.org; Sun, 06 Apr 2003 05:23:05 -0400 Original-Received: from barbara.blakulla.net ([213.212.21.238] helo=linnaeus) by kvast.blakulla.net with esmtp (Exim 3.36 #1 (Debian)) id 1926Mg-0005A4-00; Sun, 06 Apr 2003 11:23:02 +0200 Original-Received: from mdj by linnaeus with local (Exim 3.36 #1 (Debian)) id 1926Mg-0002JS-00; Sun, 06 Apr 2003 11:23:02 +0200 Original-To: Rob Browning In-Reply-To: <87he9dhoxh.fsf@raven.i.defaultvalue.org> (Rob Browning's message of "Fri, 04 Apr 2003 16:34:50 -0600") User-Agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux) Original-cc: djurfeldt@nada.kth.se 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:2133 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2133 Rob Browning writes: > (Mikael: if you get a second, could you look at random.c and make sure > you don't see any obvious mistakes. One thing in particular -- could > you look at the FIXME there -- if there's a chance that a random > bignum could end up with enough leading zeroes to place it in fixnum > territory, then we need to return scm_i_normbig (result), but I > wanted to check with you first. Returning a bignum with a value in > fixnum range would violate an assumption made by other guile > numerical code.) Yes, we certainly must normalize. The old code looked like this: /* now fill up the rest of the bignum */ while (i) bits[--i] = scm_the_rng.random_bits (state); /* use scm_i_normbig to cut away leading zeros and/or convert to inum */ b = scm_i_normbig (b); if (SCM_INUMP (b)) return b; Best regards, Mikael _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel