[Haskell-cafe] floating point operations and representation

Bulat Ziganshin bulat.ziganshin at gmail.com
Mon Mar 17 13:06:39 EDT 2008


Hello David,

Monday, March 17, 2008, 7:59:09 PM, you wrote:

>>     foreign import ccall unsafe "math.h log10"
>>         c_log10 :: CDouble -> CDouble
>>
>>     log10 :: Double -> Double
>>     log10 x = realToFrac (c_log10 (realToFrac x))

> 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.

it should be nop (no operation) in such cases


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list