binString

binString(integer x) → string string

Returns a string containing the binary representation of the integer x, with no prefix and no leading zeros: binString(12) returns "1100".

A negative number is written in 64-bit two's complement, sign bit first: binString(-1) returns the character 1 64 times. Big integers are written with their sign.

For the reverse operation, write the number directly with the binary literal 0b1100. To get the internal bits of a real number, see realBits.

binString(0)     // "0"
binString(12)    // "1100"
binString(255)   // "11111111"
binString(-1)    // "1111111111111111111111111111111111111111111111111111111111111111"
binString(0b1011)  // "1011"
(12).toString(2);   // "1100"
(255).toString(2);  // "11111111"
bin(12)    # '0b1100'
bin(255)   # '0b11111111'
Parameters
Return
Note