guile-devel
[Top][All Lists]
Advanced

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

Re: ratio implementation


From: Kevin Ryde
Subject: Re: ratio implementation
Date: Wed, 15 Oct 2003 08:56:05 +1000
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

Marius Vollmer <address@hidden> writes:
>
>   (sqrt 4) => 2 (exact)
>
> I'm not sure whether exact square roots are imortant: they will only
> be useful when both the numerator and denominator are squares of
> integers and those pairs will be rare, I'd say.

I'd wondered if some sort of isqrt or isqrt+remainder would be of more
value to those wanting integer roots.  (Though I'm aware r5rs says
exact results for exact perfect squares is desirable.)

> We could use GMP for
> computing bignum square roots...

Rob mentioned this to me at one stage, I actually started on an
attempt at it.  Code below, which might sort of work, maybe.

One concern though is to ensure the root calculated is the same for a
"double" input (which uses sqrt()) as compared to some bignum root
(using gmp + conversions).

Attachment: sqrt.c
Description: Text Data


reply via email to

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