
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. Thanks, Maurício

On 11/2/06, Maurício
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

On Thu, 2 Nov 2006, Sebastian Sylvan wrote:
On 11/2/06, Maurício
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.

Henning Thielemann wrote:
On Thu, 2 Nov 2006, Sebastian Sylvan wrote:
On 11/2/06, Maurício
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.
I've just found mod', a version of mod that works with reals (so I could use mod' x 1.0), in module Data.Fixed. However, trying to load Data.Fixed in ghci says that module doesn't exist (ghc 6.6). Maurício
participants (3)
-
Henning Thielemann
-
Maurício
-
Sebastian Sylvan