[Haskell-cafe] Non-integer part of a Double
Henning Thielemann
lemming at henning-thielemann.de
Fri Nov 3 05:40:20 EST 2006
On Thu, 2 Nov 2006, Sebastian Sylvan wrote:
> 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
However, this leaves the type of the integral part unspecified.
More information about the Haskell-Cafe
mailing list