9.3.81 LEADZ (I)

Description:  Returns the number of leading zero bits in an integer.  
Class:  Elemental function; Generic 
Arguments:  I must be of type integer. 
Results:  The result type is the same as I. The result value is the number of leading zeros in the binary representation of the integer I.

The model for the interpretation of an integer value as a sequence of bits is shown in Section D.3.

Examples

Consider the following:

  INTEGER*8 J, TWO
  PARAMETER (TWO=2)
  DO J= -1, 40
    TYPE *, LEADZ(TWO**J)  ! Prints 64 down to 23 (leading zeros)
  ENDDO
  END


Previous Page Next Page Table of Contents