[Haskell-cafe] Problems with square root...
Daniel Carrera
daniel.carrera at zmsl.com
Wed Dec 21 13:06:38 EST 2005
Hey,
The sqrt function is not doing what I want. This is what I want:
round sqrt(2)
The problem is that sqrt() returns a "Floating" value and round wants a
"ReacFrac":
--//--
*Main> round sqrt(2)
<interactive>:1:0:
No instances for (RealFrac (a -> a), Integral (t -> a1))
arising from use of `round' at <interactive>:1:0-4
Probable fix:
add an instance declaration for (RealFrac (a -> a), Integral (t
-> a1))
In the definition of `it': it = round sqrt (2)
*Main>
--//--
I'm trying to figure out how to turn a Float into a RealFrac so I can
pass it to 'round'. Any ideas?
Daniel.
--
/\/`) http://oooauthors.org
/\/_/ http://opendocumentfellowship.org
/\/_/
\/_/ I am not over-weight, I am under-tall.
/
More information about the Haskell-Cafe
mailing list