Next: MAXLOC(ARRAYDIM, MASK) Up: Specifications of Intrinsic Previous: Specifications of Intrinsic
Description. Returns one less than the length, in bits, of the
two's-complement representation of an
Class. Elemental function.
Argument. I must be of type integer.
Result Type and Type Parameter. Same as I.
Result Value. If I is nonnegative, ILEN(I) has the value ; if I is negative, ILEN(I) has the value .
Examples. ILEN(4) = 3. ILEN(-4) = 2. 2**ILEN(N-1) rounds N up to a power of 2 (for ), whereas 2**(ILEN(N)-1) rounds N down to a power of 2. Compare with LEADZ.
The value returned is one less than the length of the
two's-complement representation of I, as the following explains.
The shortest two's-complement representation of is . The
leading zero is the required sign bit. In 3-bit two's complement,