
3 Aug
2004
3 Aug
'04
8:53 p.m.
I need to convert a Double to a CDouble to pass to a C function. In the past, when I've asked how to do this, I'm told: realToFrac. This works in most cases, but recently gave me a problem that took me *forever* to track down: Prelude Foreign.C> (0 :: CDouble) / 0 NaN Prelude Foreign.C> (0 :: Double) / 0 NaN Prelude Foreign.C> realToFrac ((0 :: Double) / 0) :: CDouble -Infinity yikes! the NaN got turned into a -Infinity!!! aside from manually checking for 'strange' Double/CDouble values and wrapping realToFrac, is there a better way? also, does this count as a bug? -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume