[Haskell-cafe] Calling C function in Mac OS X

Sergey Perminov sv.perminov at gmail.com
Sat Apr 14 11:58:25 EDT 2007


I wish to optimize Haskell code using ByteString, direct reading
Doubles form it, direct writing Doubles to it.

I've tried Don Stewart's code http://hpaste.org/26
that uses calling to C functions to implement necessary readDouble & showDouble.

readDouble works ok.
showDouble always return "nan" in Mac OS X (but works well in Windows).
I'm using GHC 6.6 in Mac
(http://www.haskell.org/ghc/download_ghc_66.html#macosxppc)
and in Windows (http://www.haskell.org/ghc/download_ghc_66.html#windows).

I've made showInt based on showDouble: http://hpaste.org/1390
It works well in Mac OS X.
It seems that problem happens only when I send CDouble (or CLDouble)
to C function.

My conf: PowerBook G4, Mac OS X 10.4.9, powerpc-apple-darwin8-gcc-4.0.1

What may cause this? How to fix it?


More information about the Haskell-Cafe mailing list