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, truncated to an integer, whose absolute value lies in the range of 0 to 9223372036854775807 (This is the largest 64-bit signed 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.
