blob: e770ba315c73c0795caf708e9f51c68fd9d3fa0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
import Data.Word( Word8 )
toV :: Float -> Word8
toV d = let coeff = significand d * 255.9999 / d
a = truncate $ d * coeff
b = exponent d
in a `seq` (b `seq` a)
main :: IO ()
main =
print $ map toV [ 3.56158e-2, 0.7415215, 0.5383201, 0.1289829, 0.45520145 ]
|