[UP]


Manual Reference Pages  - poppar (3)

NAME

poppar(3f) - [FORTRAN:INTRINSIC:BIT INQUIRY] Parity of the number of bits set

CONTENTS

Syntax
Description
Arguments
Return Value
Example
Standard
Class
See Also

SYNTAX

result = poppar(i)

DESCRIPTION

Returns the parity of an integer’s binary representation (i.e., the parity of the number of bits set).

ARGUMENTS

I - Shall be of type INTEGER.

RETURN VALUE

The return value is of type ’integer’ and of the default integer kind. It is equal to 0 if I has an even number of bits set and 1 if an odd number of bits are set.

EXAMPLE

Sample program:

   program demo_population
     print *, popcnt(127),       poppar(127)
     print *, popcnt(huge(0_4)), poppar(huge(0_4))
     print *, popcnt(huge(0_8)), poppar(huge(0_8))
   end program demo_population

STANDARD

[[Fortran 2008]] and later

CLASS

[[Elemental function]]

SEE ALSO

[[popcnt]], [[leadz]], [[trailz]]


poppar (3) March 19, 2019
Generated by manServer 1.08 from 0112934c-9129-4816-b46f-4113126803f5 using man macros.