binary_to_integer("ABC", 16) * 1.0
Hi, is there any way in Elixir to turn a hexadecimal into a float?
--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
First convert the binary to its integer value, like José showed: value = binary_to_integer(binary, 16) then you can convert it to an IEEE754 float with << value :: [float, 64] >>. Change to 32 if it is in binary32 format instead of binary64.
<< value :: [float, 64] >> = <<67, 208, 0, 0, 0, 0, 0, 0>>