OS/2 Procedures Language 2/REXX


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


D2X (Decimal to Hexadecimal)




 >>---D2X(wholenumber -+-----+-)------><
                       +-,n--+

D2X returns a string of hexadecimal characters that is the hexadecimal 
representation of the decimal number. 
If n is not specified, wholenumber must be a nonnegative number and the 
returned result has no leading 0 characters. 
If n is specified, it is the length of the final result in characters; 
that is, after conversion the input string is sign-extended to the 
required length. If the number is too big to fit into n characters, it is 
shortened on the left. 
Here are some examples: 

D2X(9)         ->    '9'
D2X(129)       ->    '81'
D2X(129,1)     ->    '1'
D2X(129,2)     ->    '81'
D2X(129,4)     ->    '0081'
D2X(257,2)     ->    '01'
D2X(-127,2)    ->    '81'
D2X(-127,4)    ->    'FF81'
D2X(12,0)      ->    ''

Implementation maximum: The output string cannot have more than 250 
significant hexadecimal characters, though a longer result is possible if 
it has additional leading sign characters (0 and F).   

Inf-HTML End Run - Successful