On Wed, Mar 12, 2008 at 9:27 PM, Don Stewart <[EMAIL PROTECTED]> wrote: > You could consider binding directly to the C functions, if needed, > > {-# OPTIONS -fffi -#include "math.h" #-} > > import Foreign.C.Types > > foreign import ccall unsafe "math.h log10" > c_log10 :: CDouble -> CDouble > > log10 :: Double -> Double > log10 x = realToFrac (c_log10 (realToFrac x))
Actually, you could almost certainly just use foreign import ccall unsafe "math.h log10" log10 :: Double -> Double since in ghc CDouble and Double are identical. It's a bit sloppier, but shouldn't cause any trouble. And I've no idea how realToFrac is implemented, but would worry about it behaving oddly... for instance when given NaNs. David _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe