[Top][All Lists]

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

Re: rationalize returns inexact results.

From: Neil Jerram
Subject: Re: rationalize returns inexact results.
Date: Sun, 3 Aug 2008 00:24:12 +0100

2008/7/26 Anye Li <address@hidden>:
> Even if it is not a bug that rationalize returns inexact results (surprising
> and useless as they may be to me), I believe it is still a bug that (help
> rationalize) says "Return an exact number..." when in fact it does not.

Agreed.  I'm just fixing this now, to make (help rationalize) say the
same as the Guile manual says:

Returns the @emph{simplest} rational number differing
from @var{x} by no more than @var{eps}.

As required by @acronym{R5RS}, @code{rationalize} only returns an
exact result when both its arguments are exact.  Thus, you might need
to use @code{inexact->exact} on the arguments.

(rationalize (inexact->exact 1.2) 1/100)
@result{} 6/5


reply via email to

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