edubkendo
8/31/2014 - 6:30 AM

Elixir binary pattern matching

Elixir binary pattern matching


<< sign::size(1), exp::size(11), mantissa::size(52) >> = << 3.14159::float >>
#=> <<64, 9, 33, 249, 240, 27, 134, 110>>

(1 + mantissa / :math.pow(2, 52)) * :math.pow(2, exp - 1023)
#=> 3.14159