Difference between revisions of "Base Conversion Function Library"

 
Line 10: Line 10:
 
| '''Bin2Hex(x''''',places''''')''' || '''Oct2Hex(x''''',places''''')''' || '''Dec2Hex(x''''',places''''')''' ||
 
| '''Bin2Hex(x''''',places''''')''' || '''Oct2Hex(x''''',places''''')''' || '''Dec2Hex(x''''',places''''')''' ||
 
|}
 
|}
 +
 +
The conversions to Decimal all return numeric values, while all other conversions return text. 
 +
 +
For binary, octal and hexidecimal values, negative numbers are represented in 2's complement notation with a minimum of 10 digits.  This means that the most significant (left-most) bit is the sign bit and is set for negative numbers.  Non-decimal numbers having fewer than 10 digits are interpreted as positive.
 +
 +
The optional ''places'' parameter specifies the minimum number of decimal places in the result.  For negative numbers, this is ignored.

Revision as of 19:32, 18 March 2008

The Base Conversion Function Library provides functions for converting between binary, octal, decimal and hexidecimal representations of numbers. The functions operate equivalently to the functions with the same names in Excel.

Oct2Bin(x,places) Dec2Bin(x,places) Hex2Bin(x,places)
Bin2Oct(x,places) Dec2Oct(x,places) Hex2Oct(x,places)
Bin2Dec(x) Oct2Dec(x) Hex2Dec(x)
Bin2Hex(x,places) Oct2Hex(x,places) Dec2Hex(x,places)

The conversions to Decimal all return numeric values, while all other conversions return text.

For binary, octal and hexidecimal values, negative numbers are represented in 2's complement notation with a minimum of 10 digits. This means that the most significant (left-most) bit is the sign bit and is set for negative numbers. Non-decimal numbers having fewer than 10 digits are interpreted as positive.

The optional places parameter specifies the minimum number of decimal places in the result. For negative numbers, this is ignored.

Comments


You are not allowed to post comments.