Is there a fast and reliable way to compute the fraction of a floating
point number?

I can implement
  fraction x = snd (properFraction x :: (Int, Double))
or
  fraction x = x - fromIntegral (truncate x :: Int)
      (actually I need 'floor' not 'truncate' but this is another issue)
but these need considerably more time than
  fraction x = x - GHC.Float.int2Double (GHC.Float.double2Int x)

Is there a fast 'fraction' built-in function? Or do I have to use FFI to
modf ?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to