IB Statements/dechex

From CometWiki

Jump to: navigation, search

DECHEX function

Syntax: DECHEX(numeric-argument, numeric-error-argument)

Discussion: The DECHEX function converts a decimal number to its hexadecimal string equivalent.

The numeric-argument represents the value to be converted. It may be a constant or variable. The value of the numeric-argument may not exceed 65,535 (i.e., hex "@FFFF@"). The numeric-argument may be a numeric constant, a single-element numeric variable, a numeric array element, a numeric expression, or a numeric function.

The numeric-error-argument reports the success or failure of the conversion. It is set to 1 if there is a conversion error; otherwise, it is set to 0. The numeric-error-argument must be a single-element numeric variable or a numeric array element.

Example: X$ = DECHEX(NUM,ERR)

In the above example, the value of the numeric variable NUM is used to establish the equivalent hex string and the resulting value is stored in X$. The variable ERR reports on the success or failure of the conversion.

For example, if NUM equals 255, X$ will equal "@FF@" (the hex equivalent of 255), and ERR will equal 0 (indicating a successful conversion).

Or, if NUM equals 12,345, X$ will equal "@3039@" (the hex equivalent of 12,345), and ERR will equal 0.

Personal tools