blackode
Published in

blackode

Best question to ask

Why <<5::2>> == <<1::2>>? Elixir

Bits vary in size not in numbers

Photo by Sharon McCutcheon on Unsplash

This article talks about the bitstrings and binaries representation. Let’s dive.

In Elixir we use <<0>> for binary(8 bits) reprsentation. However, we can tell how many bits of information we need with size(num) i.e <<5::size(3)>> for 3 bits instead of size(8) which is…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store