3.5.11.2 Bin2Dec


Description

Convert a binary number to decimal.

Syntax

int Bin2Dec(string str$)

Parameters

str$

A string representation of a binary number.

Return

Return the decimal value of a binary number. The argument is currently limited to 10 characters which are interpreted as negative if the character in the 10th position is 1. This results in a range from -512 to +511.

Example

bin2Dec(1001) = ;  // 9

string strBin$ = 1111111111;
int n = bin2Dec(strBin$);
n = ;  // -1

See Also

Dec2Bin, Dec2Hex, Hex2Dec