poppar(3f) - [FORTRAN:INTRINSIC:BIT INQUIRY] Parity of the number of bits set
Syntax
Description
Arguments
Return Value
Example
Standard
Class
See Also
result = poppar(i)
Returns the parity of an integers binary representation (i.e., the parity of the number of bits set).
I - Shall be of type INTEGER.
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.
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
[[Fortran 2008]] and later
[[Elemental function]]
[[popcnt]], [[leadz]], [[trailz]]
poppar (3) | March 19, 2019 |