bits()

Read(260) Label: decimal, numeric,

Description:

Convert to a decimal number.

Syntax:

bits(xi,…)

Note:

This function is equal to sum(2i-1*xi), which converts a number of other numeral systems to a decimal integer. First convert xi to an integer if it is a string.

If there is only a single xi and it is a string, split it into a sequence of single characters first.

Parameters:

xi

The integer/string to be converted

Options:

@h

Equivalent to sum(16i-1*xi). First convert xi to the integer according to the rules of hexadecimal numeral system if it is the string

@d

Equivalent to sum(10i-1*xi). First convert xi to the integer if it is the string

@n

Equivalent to sum(2i-1*if(xi,1,0)). Convert null or nonnull xi to corresponding value

@s

It works with other options to return a string that is equivalent to the number of the specified numeral system

Return value:

Numeric value

Example:

 

A

 

1

[1,0,1,1]

 

2

=bits(A1)

13

3

=bits("1011")

13. Split the single string into a sequence. It is equal to  =bits("1","0","1","1")

4

=bits@d(1,1,1,5)

5111

5

=bits@n(1,1,1,5)

15

6

=bits@h("A",1,1,5)

20762

7

=bits@sn(12)

1

8

=bits@sd(12)

12

9

=bits@sh(1212)

4bc