popcnt(3f) - [FORTRAN:INTRINSIC:BIT INQUIRY] Number of bits set
Syntax
Description
Arguments
Return Value
Example
Standard
Class
See Also
result = popcnt(i)
Returns the number of bits set in the binary representation of an integer.
I - Shall be of type INTEGER.
The return value is of type integer and of the default integer kind.
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]]
[[poppar]], [[leadz]], [[trailz]]
popcnt (3) | March 19, 2019 |