Safe Haskell | None |
---|---|
Language | Haskell98 |
Loading and storing doubles directly from/to memory buffers.
- loadDouble :: Ptr Word8 -> Int -> IO (Double, Int)
- storeDoubleShortest :: Double -> IO (ForeignPtr Word8, Int)
- storeDoubleFixed :: Int -> Double -> IO (ForeignPtr Word8, Int)
Loading
:: Ptr Word8 | Buffer holding ASCII representation. |
-> Int | Length of buffer. |
-> IO (Double, Int) | Result, and number of characters read from buffer. |
Load an ASCII Double
from a foreign buffer
returning the value and number of characters read.
Storing
storeDoubleShortest :: Double -> IO (ForeignPtr Word8, Int) Source
Store an ASCII Double
, yielding a freshly allocated buffer
and its length.
- The value is printed as either (sign)digits.digits, or in exponential format, depending on which is shorter.
- The result is buffer not null terminated.
storeDoubleFixed :: Int -> Double -> IO (ForeignPtr Word8, Int) Source
Like showDoubleShortest
, but use a fixed number of digits after
the decimal point.