Since 36 characters are available to write digits, we would not expect a number written in a base be extended.

   10bx
33

   datatype 10bx
integer

   10b.x        NB. floating point
3.3


j probably could permit an extended vector

   {:0x  16b53973c0482de06eddf68d4531e9062c7
|ill-formed number


Finally,

16x#.16b5 16b3 16b9 16b7 16b3 16bc 16b0 16b4 16b8 16b2 16bd 16be 16b0 16b6 16be 16bd 16bd 16bf 16b6 16b8 16bd 16b4 16b5 16b3 16b1 16be 16b9 16b0 16b6 16b2 16bc 16b7
111111177777777111111111777777771111111

   16x#.(Num_j_,26}.Alpha_j_)i.'53973c0482de06eddf68d4531e9062c7'
111111177777777111111111777777771111111





On 06/17/2016 08:00 AM, [email protected] wrote:
Message: 1
Date: Fri, 17 Jun 2016 13:52:52 +0300
From: Moon S <[email protected]>
To: programming <[email protected]>
Subject: [Jprogramming] Fwd:  16bHHHHHHHH...HHx - no way
Message-ID:
        <cag++_noovuywrrgk+21bd+bmc8qa0c1xypwhf7kul6hwn8f...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

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


------------------------------

Subject: Digest Footer

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

------------------------------

End of Programming Digest, Vol 129, Issue 34
********************************************

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to