unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mikael Djurfeldt <djurfeldt@nada.kth.se>
Cc: guile-devel@gnu.org
Subject: Re: GMP code committed -- watch for bugs.
Date: Sun, 06 Apr 2003 11:23:01 +0200	[thread overview]
Message-ID: <xy7llyokmiy.fsf@nada.kth.se> (raw)
In-Reply-To: <87he9dhoxh.fsf@raven.i.defaultvalue.org> (Rob Browning's message of "Fri, 04 Apr 2003 16:34:50 -0600")

Rob Browning <rlb@defaultvalue.org> 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


  parent reply	other threads:[~2003-04-06  9:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-04 22:34 GMP code committed -- watch for bugs Rob Browning
2003-04-05 12:24 ` Marius Vollmer
2003-04-05 21:51 ` Mikael Djurfeldt
2003-04-05 22:26   ` Rob Browning
2003-04-06  7:41     ` Mikael Djurfeldt
2003-04-06  9:16   ` Mikael Djurfeldt
2003-04-06 18:43     ` Rob Browning
2003-04-06 19:12       ` Mikael Djurfeldt
2003-04-06 20:09         ` Rob Browning
2003-04-06 20:25     ` Rob Browning
2003-04-06  9:23 ` Mikael Djurfeldt [this message]
2003-04-06 20:15   ` Rob Browning
2003-04-06 22:50 ` Kevin Ryde
2003-05-10  0:22   ` GMP code committed -- watch for bugs ... gcd n 0 Kevin Ryde
2003-04-23 22:40 ` GMP code committed -- watch for bugs Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xy7llyokmiy.fsf@nada.kth.se \
    --to=djurfeldt@nada.kth.se \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).