How do I take the square root of a number in Elixir? There doesn't seem to be a Math
module or anything, and there is no function like sqrt()
.
Elixir compiles to BEAM, which makes it compatible with Erlang modules. As you said, :math.sqrt(x)
is essentially running Erlang code.