$ erl
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]
Eshell V5.8.4 (abort with ^G)
%% The base (16) followed by the hex value (0F), number is returned as a decimal.
1> 16#0F.
15
%% lets convert our value back,
2> integer_to_list(15, 16).
"0F"
This is of course covered in the erlang manuals, but Its nice to have it in one place.
I regularly work in crash so, I need to do basic math in hex, which I usually do something like this
3> integer_to_list(16#0F + 16#FF, 16).
"10E"
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]
Eshell V5.8.4 (abort with ^G)
%% The base (16) followed by the hex value (0F), number is returned as a decimal.
1> 16#0F.
15
%% lets convert our value back,
2> integer_to_list(15, 16).
"0F"
This is of course covered in the erlang manuals, but Its nice to have it in one place.
I regularly work in crash so, I need to do basic math in hex, which I usually do something like this
3> integer_to_list(16#0F + 16#FF, 16).
"10E"
No comments:
Post a Comment