Base Conversion Function Library

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

Source ▶
Target ▼ Bin Oct Dec Hex
Bin Oct2Bin(x, places) Dec2Bin(x, places) Hex2Bin(x, places)
Oct Bin2Oct(x, places) Dec2Oct(x, places) Hex2Oct(x, places)
Dec Bin2Dec(x) Oct2Dec(x) Hex2Dec(x)
Hex 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.

Using the Library

To use these functions in your model, you must add the Base Conversion Library.ana library to your model. This library uses functions that are new to Analytica 4.1, and thus requires at least Analytica 4.1 to use. To add, select FileAdd Library... and find the Base Conversion Library.ana file. If this isn't already in your Libraries directory, then you can download it here: Base Conversion Library.ana.

After selecting, you can select either embedded or linked. Once added, the library appears on your definition menu and the functions may be used.

History

Introduced in Analytica 4.1.