Help me understand floats in bitstring behaviour

Can somebody explain to me why one works and the other doesn’t? I feel like I should already know this, but I don’t :sweat_smile:

iex> <<3.14::32>>
<<64, 72, 245, 195>>

iex> x = 3.14
iex> <<x::32>>
** (ArgumentError) argument error while evaluating iex at line 3
1 Like

When no specifier is given and the value is not a literal, it is assumed to be integer. <<x::float-32>> will address it. :slight_smile: