[Haskell-cafe] Non-integer part of a Double

Sebastian Sylvan sylvan at student.chalmers.se
Thu Nov 2 17:04:10 EST 2006


On 11/2/06, Maurí­cio <briqueabraque at yahoo.com> wrote:
>    Hi,
>
>    Is there a function to get that? I'm using
>
> \x -> x - fromIntegral(floor x)
>
> since I was not able to find something better, but I guess I have missed
> something in the standard library since there are functions with similar
> funcionality.

How about
frac :: RealFrac a => a -> a
frac = snd . properFraction

/S
-- 
Sebastian Sylvan
+46(0)736-818655
UIN: 44640862


More information about the Haskell-Cafe mailing list