3.5.11.6 Dec2Bin

Description

Convert a decimal number to binary. The input range is limited to -512 to 511.

Syntax

string Dec2Bin(int n)$

Parameters

n

The decimal number to convert to binary.

Return

Return a string for the binary result.

Example

dec2Bin(9)$ = ;  // 1001

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

See Also

Bin2Dec, Dec2Hex, Hex2Dec