Documentation/Calc Functions/BIN2DEC/en

Function name:
BIN2DEC

Category:
Add-in

Summary:
Converts a binary number (base-2) to its decimal (base-10) equivalent. The input binary number must correspond to a decimal number d in the range -512 ≤ d < 512.

Syntax:
BIN2DEC(Number)

Returns:
Returns an integer number in the range -512 ≤ d < 512, which is the decimal value that corresponds to the specified binary number.

Arguments:
Number is a string or a number, or a reference to a cell containing one of those types, which gives the binary number that is to be converted to decimal. The binary number must comprise only the digits 0 and 1, and must be no more than 10 digits long.


 * Number should use the standard two's complement representation, so that positive numbers are binary 0 to 111111111 (0 to 511 decimal) and negative numbers are binary 1111111111 to 1000000000 (-1 to -512 decimal). Negative numbers must be 10 digits long with the leftmost bit set to 1; positive numbers can comprise less than 10 digits.
 * If Number does not specify a valid binary number, then BIN2DEC reports an invalid argument error (Err:502). This may arise, for example, if Number contains more than 10 characters or if it contains any character other than the digits 0 and 1.
 * If Number is a string comprising no characters, or a reference to an empty cell, BIN2DEC returns 0.
 * Although the content of Number appears to be decimal, BIN2DEC will interpret it correctly.

Additional details:
The following Wikipedia pages provide useful background information that is relevant to this function:
 * Binary number
 * Two's complement

Related LibreOffice functions:
BIN2HEX

BIN2OCT

ODF standard:
Section 6.19.14, part 2

Equivalent Excel functions:
BIN2DEC