Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- convertNBytesLen :: [Word8] -> Int32
- convertNBytesLen = foldr accum 0
- where accum bs a = 256 * a + fromIntegral bs
- bsToDouble :: S.ByteString -> Int -> Double
- bsToDouble bs n = if intV >= 0
- then fromIntegral intV / 2147483647
- else - (fromIntegral intV / (-2147483648))
- where intV = convertNBytesLen (S.unpack bs) `shift` (32 - 8 * n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement