[Haskell-cafe] Fractional sqrt
gale at sefer.org
Fri Jan 19 07:44:08 EST 2007
> I only need sqrt, so probably I will... use... just
> the simple Newton alg.
It is still not clear to me what type you want
to work in. Is it Rational? In that case, you don't
need the Newton algorithm.
realToFrac . sqrt . realToFrac
works fine, as you originally suggested. If that gives
too much precision, you can use
(`approxRational` epsilon) . sqrt . realToFrac
Newton will not work in general for Fractional. It works
for Floating, but there you already have the sqrt function.
Are you using a type that has a Fractional instance,
does not have a Floating instance, and Newton works
and is needed? What type is that?
> a good math library would make Matlab obsolete. :)
Yes, that would certainly be nice. This has been
discussed at length several times on this list in the past.
I wonder if there has been any further progress on it.
More information about the Haskell-Cafe