Ones

(Engine-Level Function)

Description: Returns the number of bits set in an integer number.
Returns: Numeric
Usage: Script or steady state.
Function Groups: Bitwise Operation
Related to: Bit | SetBit
Format: Ones(Value)
Parameters:  
Value
Required. Any numeric expression.
Comments: Value must be a valid number and is truncated to an integer. The number of bits set is returned.

Examples:

a = Ones(0b010110);
b = Ones(0b001100);
c = Ones(2.3);

The values of a, b and c will be 3, 2 and 1 respectively.