Kevin Ryde <[EMAIL PROTECTED]> writes:
> Thanks. I fixed integer-expt to reject an exponent +/-inf.
Hmm, we could only allow exact integers. That would reject +/-inf as
well. Right now, we have
(exact? (integer-expt 2 2.0))
=> #t
which seems wrong.
> It got there because (integer? -inf.0) => #t, which seems pretty
> wrong to me, so I changed that to #f. That expt now goes to pow(),
> giving 0.
Making the infinities integers was done on purpose, to follow the lead
of PLT Scheme. After all
floor (inf) == inf && ceil (inf) == inf
It would not be good to be gratuitously incompatible with PLT Scheme
here.
I propose to have integer-expt reject all inexact integers and change
expt so that it does not use it for inexact numbers.
That way, we can correctly compute things like
(expt 2 -inf.0)
=> 0.0
(expt 0.5 -inf.0)
=> +inf.0
[ Also, integer-expt now also works with negative exponents, but the
docstring doesn't state this and expt could be simplyfied by
exploiting it.
]
Opinions?
_______________________________________________
Bug-guile mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/bug-guile