guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IEEE Inf and NaN support for numbers.c


From: John W. Eaton
Subject: Re: IEEE Inf and NaN support for numbers.c
Date: Thu, 21 Mar 2002 15:16:53 -0600

On 14-Mar-2002, Marius Vollmer <address@hidden> wrote:

| "John W. Eaton" <address@hidden> writes:
| 
| > The following patch adds basic IEEE Inf and NaN support for guile.  This
| > introduces two new predicates (inf? and nan?) and two new functions
| > (inf and nan, which return IEEE Infinity and NaN values,
| > respectively).
| 
| Nice, thanks.
| 
| >   guile> (/ 0)
| >   Inf
| 
| This is not a good print syntax for the new "inf" value.  It looks
| like a symbol, while it really is a number.  Likewise for "NaN".
| 
| What about using "1/0" for inf and "0/0" for NaN.  Does this fit with
| the IEEE rules?

I suppose it would work, but it is a bit misleading, because Inf and
NaN can be generated in ways other than just 1/0 and 0/0.

| When this works, we don't need the 'inf' and 'nan' procedures.

Sure, but perhaps it is nice to have a way to request a NaN or Inf
value without having to perform additional arithmetic operations?

Eventually, I'd like to be able to make it possible to control what
happens when Inf and NaN are generated.  For example, generate an
exception instead of simply continuing.  In that case, it might be
good to have another way to get at Inf and NaN without generating the
exception.

I'd also be happy to have these procedures only available if some
package/module/whatever is loaded, but I don't know how to do that
(yet).

| Do we want to care about signalling versus quiet NaNs, and the extra
| information in the mantissa of NaNs?  (I don't think so.)

Perhaps not yet, but it might be useful to have these things later.

| Also, somewhat unrelated to your patch, Guile can not read the
| (illegal) notation "#.#" that is produces for funny numbers.  It's
| probably best to avoid outputting this notation altogether and just
| find a way to cope with funny numbers more sanely.  (Like you just did
| for infinity.)

Right, I wasn't sure what to do with the #.# thing, so I tried to
leave it alone as much as possible.

BTW, would people object to reformatting numbers.c to follow the GNU
coding standards?

Thanks,

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]