It seems that there's no extended hexadecimal literals in J.
The decimal ones work ok. Let's convert a long integer to its hex
representation
'0123456789abcdef'{~16#.^:_1 (111111177777777111111111777777771111111x)
53973c0482de06eddf68d4531e9062c7
16b53973c0482de06eddf68d4531e9062c7 NB. no, it will be a usual float
1.11111e38
16b53973c0482de06eddf68d4531e9062c7x NB. no, 'x' is just a (wrong)
digit
1.77778e39
x:16b53973c0482de06eddf68d4531e9062c7 NB. nope
111111177777777116167868047726401814528
x:'16b53973c0482de06eddf68d4531e9062c7' NB. you wish! :)
|domain error
| x:'16b53973c0482de06eddf68d4531e9062c7'
But sure one can convert a vector of small hex numbers, although it
requires writing '16b' for each of them:
(2^32x)#. 16b53973c04 16b82de06ed 16bdf68d453 16b1e9062c7
111111177777777111111111777777771111111
Or convert a string:
X=:16x#.'0123456789abcdef'i.] NB. it's like dfh but
for extended ints
X'53973c0482de06eddf68d4531e9062c7' NB. Hello IBM!
111111177777777111111111777777771111111
Or treat pre-formatted strings, as they are usually written in some
documentation, for example, test cases for encryption. And this is 4.5
times faster, than the previous method (J 8.04 64-bit, Windows).
(2^32x)#. ".&('16b'&,)&> ' 'splitstring '53973c04 82de06ed df68d453
1e9062c7'
111111177777777111111111777777771111111
---
Georgiy Pruss
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm