unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Marius Vollmer <mvo@zagadka.ping.de>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: IEEE Inf and NaN support for numbers.c
Date: 07 May 2002 00:39:25 +0200	[thread overview]
Message-ID: <87sn54dhpe.fsf@zagadka.ping.de> (raw)
In-Reply-To: <87662gd8zz.fsf@zagadka.ping.de>

Marius Vollmer <mvo@zagadka.ping.de> writes:

> Ok.  I think we should follow PLT Scheme here.  I will apply your
> patch and make the necessary changes.

Done.  Please play with it and tell me whether you like the changes I
made.

	numbers.c (mem2ureal): Recognize "inf.0" and "nan.xxx".
	(scm_even_p, scm_odd_p): Treat infinity as even and odd.
	(iflo2str): Don't output a '+' for negative numbers or for Inf and
	NaN.  They will provide their own sign.
	(scm_divide): Only allow divides by inexact zeros.  Dividing by
	exact zeros still signals an errors.

Here is the NEWS entry:

    ** There is support for Infinity and NaNs.

    Following PLT Scheme, Guile can now work with infinite numbers and
    'not-a-numbers'.

    There is new syntax for numbers: "+inf.0" (infinity), "-inf.0"
    (negative infinity), "+nan.0" (not-a-number), and "-nan.0" (same as
    "+nan.0").  These numbers are inexact and have no exact counterpart.

    Dividing by an inexact zero returns +inf.0 or -inf.0, depending on the
    sign of the dividend.  The infinities are integers, and they answer #t
    for both 'even?' and 'odd?'. The +nan.0 value is not an integer and is
    not '=' to itself, but '+nan.0' is 'eqv?' to itself.

    For example

        (/ 1 0.0)
        => +inf.0

        (/ 0 0.0)
        => +nan.0

        (/ 0)
        ERROR: Numerical overflow

PLT Scheme does also distinguish plus and minus zero:

    (= 0.0 -0.0)
    => #t

but

    (eqv? 0.0 -0.0)
    => #f

I think we should do this as well.  John, how would one test for the
sign of zero?

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2002-05-06 22:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <15494.39950.119995.223196@segfault.bogus.domain>
2002-03-14 20:59 ` IEEE Inf and NaN support for numbers.c Marius Vollmer
2002-03-21 21:16   ` John W. Eaton
2002-03-22  0:59     ` Rob Browning
2002-03-22  9:18       ` Neil Jerram
2002-04-24 19:11     ` Marius Vollmer
2002-04-24 21:07       ` John W. Eaton
2002-04-24 22:31         ` Marius Vollmer
2002-05-06 22:39           ` Marius Vollmer [this message]
2002-05-15  5:36             ` John W. Eaton
2002-05-15 19:27               ` Marius Vollmer
2002-04-24 22:51         ` Rob Browning

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=87sn54dhpe.fsf@zagadka.ping.de \
    --to=mvo@zagadka.ping.de \
    --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).