$D2X: Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle"><section begin="desc" />Hex representation of integer<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Hex representation of integer<section end="desc" /></span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $D2X function is [[ | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $D2X function is the [[IntegerToHex (Float function)]]. For a full list of string and numeric conversion functions see [[List of String methods]] and [[List of Float methods]].</p> | ||
The $D2X function returns a string which is the hexadecimal equivalent of an integer. | The $D2X function returns a string which is the hexadecimal equivalent of an integer. | ||
Line 18: | Line 18: | ||
<p class="caption">%RESULT is set to the width-char hexadecimal representation of int_val.</p> | <p class="caption">%RESULT is set to the width-char hexadecimal representation of int_val.</p> | ||
The following program will print the value <tt>0C1</tt>: | |||
<p class="code"> B | <p class="code"> B | ||
PRINT $D2X(193, 3) | PRINT $D2X(193, 3) | ||
Line 38: | Line 38: | ||
<p class="caption">Products authorizing $D2X | <p class="caption">Products authorizing $D2X | ||
</p> | </p> | ||
[[Category:$Functions|$D2X]] | [[Category:$Functions|$D2X]] |
Revision as of 19:30, 31 January 2011
<section begin="desc" />Hex representation of integer<section end="desc" />
Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $D2X function is the IntegerToHex (Float function). For a full list of string and numeric conversion functions see List of String methods and List of Float methods.
The $D2X function returns a string which is the hexadecimal equivalent of an integer.
$D2X accepts two optional arguments and returns a string value.
The first argument is the integer to be converted to hexadecimal. If it is omitted, or if after conversion to an integer it can't be represented as a 32 bit 2's complement value, the null string is the result.
The second argument is the number of output characters in the string. If it is omitted, the output is 8 characters. If, after conversion to an integer, it is 0 or less, or can't be represented as a 31 bit value, the null string is the result. If it is greater than 8, then the output is 8 characters. If it is less than 8, then the leftmost digits of the hexadecimal equivalent are dropped.
Syntax
<section begin="syntax" /> %RESULT = $D2X(int_val, width) <section end="syntax" />
The following program will print the value 0C1:
B PRINT $D2X(193, 3) END