inexact->exact
Jim White
jim@pagesmiths.com
Fri Nov 8 09:21:00 GMT 2002
Marco Vezzoli wrote:
> jim@pagesmiths.com wrote:
>
>>>...
>>>call to log (0.0)
>>>return from log => #i-1/0
>>
>>That is the correct result. The logarithm of zero is not a number.
>
> You are right, I simply copied the routine and the examples the author
> gived which included tests with zeroes. Maybe the scheme implementations
> where the routine was written are more permissive (or simply wrong) with
> the log arguments.
As far as a the specification goes, since the result of (log 0) is not
defined, there isn't any way to be wrong. Other implementations are
probably doing what Java does, which is to return a negative infinity
float. So actually I should have said it is undefined for Scheme (and
CL) specifications because IEEE does define -infinity as a number.
Same goes for inexact->exact's use of an exception for an invalid
number. Friendlier though would be to return infinity (negative or
positive depending on the numerator's sign) rather than an exception at
that point.
Jim
More information about the Kawa
mailing list