unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
Subject: Re: GMP code committed -- watch for bugs.
Date: Thu, 24 Apr 2003 08:40:22 +1000	[thread overview]
Message-ID: <87d6jcn8h5.fsf@zip.com.au> (raw)
In-Reply-To: 87he9dhoxh.fsf@raven.i.defaultvalue.org

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


      parent reply	other threads:[~2003-04-23 22:40 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
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 ` Kevin Ryde [this message]

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=87d6jcn8h5.fsf@zip.com.au \
    --to=user42@zip.com.au \
    /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).