A few notes may help:

   f=: 13 :'((3#x) #:y){''0123456789ABCDEF'''
   16 f 456
1C8

   g=: 13 :'(x(#.^:_1)y){''0123456789ABCDEF'''
  16 g 456
1C8

   f
'0123456789ABCDEF' {~ ] #:~ 3 # [
  g
'0123456789ABCDEF' {~ #.^:_1

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Henry Rich
Sent: Sunday, October 30, 2011 9:04 AM
To: Programming forum
Subject: Re: [Jprogramming] Hexadecimal

    '0123456789ABCDEF' {~ 16 (#.^:_1) 456
1C8

x #: y converts y to base x, mod */x (with exceptions if x contains 
zeros).  If you want to have an unlimited number of digits, use #.^:_1 
as shown above.

Henry Rich

On 10/30/2011 8:50 AM, David Vaughan wrote:
> How could I convert decimal numbers to hexadecimal in J? I thought the #.
verb would help, but either it doesn't or I was doing it wrong.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to