[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GMP code committed -- watch for bugs.
From: |
Mikael Djurfeldt |
Subject: |
Re: GMP code committed -- watch for bugs. |
Date: |
Sun, 06 Apr 2003 11:23:01 +0200 |
User-agent: |
Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux) |
Rob Browning <address@hidden> 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
Re: GMP code committed -- watch for bugs.,
Mikael Djurfeldt <=
Re: GMP code committed -- watch for bugs., Kevin Ryde, 2003/04/06
Re: GMP code committed -- watch for bugs., Kevin Ryde, 2003/04/23