guile-devel
[Top][All Lists]
Advanced

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

Re: scm_num2int change


From: Dirk Herrmann
Subject: Re: scm_num2int change
Date: Sun, 23 Sep 2001 10:55:07 +0200 (MEST)

On Sun, 23 Sep 2001, Maciej Stachowiak wrote:

> On 23Sep2001 10:31AM (+0200), Dirk Herrmann wrote:
> > On Fri, 21 Sep 2001, Bill Schottstaedt wrote:
> > 
> > > > > Where in "num" does it say "exact num"?
> > > > Where in "num" does it say "integer"? :)
> > 
> > Well, first some words about the 'content layer' of this thread:  I
> > agree with Bill that scm_num2<foo> should accept _any_ number.  IMO,
> > rounding should be used to produce an integer, and inexact->exact should
> > be used to produce an exact result.  The reason why I think so is that the
> > names scm_num2<foo> don't indicate any restriction with respect to the
> > type of number they accept. 
> 
> What should these functions do with complex numbers?

They should throw a 'range error' (except the imaginary part happens to be
0.0 - in this case without any rounding).  Just like, for example, a huge
integer that does not fit into a C int.  The fact that we don't restrict
the input number type does not mean that no errors can occur.

However, your example makes it clear that the names 'scm_num2int' and
friends are actually bad names.  We should deprecate them and switch to
something like Mikael's proposal.

Best regards
Dirk Herrmann




reply via email to

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