bug-guile
[Top][All Lists]
Advanced

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

Re: rationalize returns inexact results.


From: Bill Schottstaedt
Subject: Re: rationalize returns inexact results.
Date: Fri, 25 Jul 2008 10:33:45 -0700

> Since Guile now supports exact rationals, shouldn't it return an exact result?

I actually agree with you (I implemented rationalize in Guile, and originally
it always returned a ratio -- why else call it "rationalize"?), but Marius
pointed out that R5RS says "With the exception of inexact->exact, the 
operations described in this section must generally return inexact results
when given any inexact arguments" in the section including rationalize.
I doubt that R6RS fixed this bug.  So, to get an exact result you need to
give exact arguments:

guile> (rationalize (inexact->exact .33) 1/10)
1/3






reply via email to

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