guile-devel
[Top][All Lists]
Advanced

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

Re: real numbers and integer-expt.


From: Marius Vollmer
Subject: Re: real numbers and integer-expt.
Date: 13 Mar 2002 20:23:56 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

Rob Browning <address@hidden> writes:

> integer-expt says:
> 
>   SCM_DEFINE (scm_integer_expt, "integer-expt", 2, 0, 0,
>               (SCM n, SCM k),
>             "Return @var{n} raised to the non-negative integer exponent\n"
>             "@var{k}.\n"
>             "\n"
> 
> but in the code we check to see if k satisfies SCM_REALP and if it
> does, we coerce it to an int and see if we get any lossage.  If we
> don't then we decide it's OK to use it.  Is that what we want,

Yes.  Floats can be integers, too.  However, there's a bug
nevertheless: floats can represent integers that don't fit into 32 bit
ints.  Also, complex numbers can be ints as well.  Also also, the
docstring talks about non-negative powers, but the code handles
negative ones as well.



reply via email to

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