> Elixir does not have a separate set of operators for floats and integers, so you would not be able to infer which type of number the variable needs to be.
Elixir doesn't care; it'll convert to a float if necessary (namely, if one of the arguments is a float):
iex(1)> 1 * 1.0
1.0
This is identical to the behavior of e.g. Julia:
julia> 1 * 1.0
1.0
> The most optimal solution in my opinion would be a type annotation for the function
My point is that the type annotations are redundant, at least in this particular case; the acceptable types are already obvious from the function definition itself.
Elixir doesn't care; it'll convert to a float if necessary (namely, if one of the arguments is a float):
This is identical to the behavior of e.g. Julia: > The most optimal solution in my opinion would be a type annotation for the functionMy point is that the type annotations are redundant, at least in this particular case; the acceptable types are already obvious from the function definition itself.