Skip to content

Latest commit

 

History

History
58 lines (54 loc) · 740 Bytes

File metadata and controls

58 lines (54 loc) · 740 Bytes
> b = <<1, 2, 3>>
<<1, 2, 3>>
> byte_size b
3
> bit_size b
24
> b = <<1::size(2), 1::size(3)>>
<<9::size(5)>>
> byte_size b
1
> bit_size b
5
> 0b01_001
9
> int = <<1>>
<<1>>
> byte_size int
1
> bit_size int
8
> float = <<2.5::float>>
<<64, 4, 0, 0, 0, 0, 0, 0>>
> byte_size float
8
> bit_size float
64
mix = <<int::binary, float::binary>>
<<1, 64, 4, 0, 0, 0, 0, 0, 0>>
> byte_size mix
9
> bit_size mix
72
> <<sign::size(1), exp::size(11), mantissa::size(52)>> = <<3.14159::float>>
<<64, 9, 33, 249, 240, 27, 134, 110>>
> sign
0
> exp
1024
> mantissa
2570632149304942
> (1 + mantissa / :math.pow(2, 52)) * :math.pow(2, exp-1023)
3.14159
> :math.pow(2, 52)
4503599627370496.0
> :math.pow(2, exp-1023)
2.0