IRAF help page for package language, program radix

from NOAO radix -- encode a number in any radixUSAGEPARAMETERSDESCRIPTIONEXAMPLESBUGSSEE ALSO

radix -- encode a number in any radix


USAGE

string = radix (number, newradix)


PARAMETERS

number

The integer number to be encoded.

newradix

The radix or base in which the number is to be printed, e.g., 2 (binary), 8 (octal), 10 (decimal), 16 (hex), and so on.


DESCRIPTION

Radix is a string valued intrinsic function which formats an integer number in the indicated radix, return the encoded string as the function value. Note that the CL permits numbers to be input in octal or hex format (trailing B or X suffix respectively), allowing common numeric conversions to decimal to be done directly. The radix function is however the only CL function currently available for printing numbers in bases other than 10. Radix can only be called as a function.


EXAMPLES

1. Print the hex number 7cde in binary.

cl> = radix (7cdex, 2)

2. Print the hex number 7cde in decimal.

cl> = 7cdex

3. Print the number in variable I in decimal, octal, and hex.

cl> print (i, radix(i,8), " ", radix(i,16))


BUGS

Very large bases produce strange results.


SEE ALSO

print,


This page automatically generated from the iraf .hlp file. If you would like your local iraf package .hlp files converted into HTML please contact Dave Mills at NOAO.

dmills@noao.edu