TreeSearch (version 0.4.0)

AsBinary: Convert a number to binary

Description

Provides a (reversed) binary representation of a decimal integer

Usage

AsBinary(x)

Arguments

x

Decimal integer to be converted to binary bits

Value

An array corresponding to binary digits 1, 2, 4, 8, 16, ...

'Leading zeros' are not included.

Details

Provides an array corresponding to binary digits 1, 2, 4, 8, 16, ...

Binary number 0100 (= decimal 4) will be represented as 0 0 1.

Examples

Run this code
# NOT RUN {
  AsBinary(4)  # 0 0 1
  AsBinary(10) # 0 1 0 1

# }

Run the code above in your browser using DataLab