Dec2Hex

 

Contents

Description

Convert a decimal number to hexadecimal.

Beginning with Origin 2019, worksheets and matrices support display of hexadecimal numbers.

Syntax

string Dec2Hex(int n[,places])$

Parameters

n

The decimal number to convert to hexadecimal.

Return

Return the hexadecimal string equivalent of the specified decimal value. Optionally, specify the number of characters in the hexadecimal string equivalent and if that number of characters exceeds the number needed to express the value, pad with zero (0).

Example

dec2Hex(-28)$ = ;  // FFFFFFE4

string strHex;
int n = 12;
strHex$ = dec2Hex(n)$;
strHex$ = ;  // C
bb=305402130; // numeric value
str1$="0x";
str2$=Dec2Hex(bb,16)$; // store numeric as string & pad as needed to 16 characters
hex$=str1$+str2$;
hex$=; // returns hex value 0x0000000012341112 as string

See Also

Bin2Dec, Dec2Bin, Hex2Dec