I have binary strings in the form of either:
<<"5.7778345">>
or
<<"444555">> >
<<"444555">>
This is the pattern that we use:
binary_to_number(B) -> list_to_number(binary_to_list(B)). list_to_number(L) -> try list_to_float(L) catch error:badarg -> list_to_integer(L) end.