[plt-scheme] inexact->exact

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun May 25 15:41:59 EDT 2003

At Fri, 23 May 2003 15:57:15 -0700, "Alex Peake" wrote:
> I tried inexact->exact and it is very slow.

Can you show an exaple where it's slow?

In case it's relevant, I note that the combination

  (floor (inexact->exact x))

will be *much* slower than the combination

  (inexact->exact (floor x))

The reason is that computing the floor of an inexact number is cheap,
and converting an inexact integer to an exact integer is also cheap,
but building the exact rational for an inexact number (without losing
any precision) is in general quite expensive.


Posted on the users mailing list.