Manual Reference Pages  - ble (3fortran)

NAME

BLE(3) - [BIT:COMPARE] Bitwise less than or equal to

SYNOPSIS

result = ble(i,j)

         elemental logical function ble(i, j)

integer(kind=**),intent(in) :: i integer(kind=**),intent(in) :: j

CHARACTERISTICS

o I and J may be of any supported integer kind, not necessarily the same. An exception is that values may be a BOZ constant with a value valid for the integer kind available with the most bits on the current platform.
o the returned value is a logical scalar of default kind

DESCRIPTION

BLE(3) determines whether an integer is bitwise less than or equal to another, assuming any shorter value is padded on the left with zeros to the length of the longer value.

OPTIONS

o I : the value to compare J to
o J : the value to be tested for being less than or equal to I

RESULT

The return value is .true. if any bit in J is less than any bit in I starting with the rightmost bit and continuing tests leftward.

EXAMPLES

Sample program:

    program demo_ble
    use,intrinsic :: iso_fortran_env, only : int8, int16, int32, int64
    implicit none
    integer            :: i
    integer(kind=int8) :: byte
      ! Compare some one-byte values to 64.
       ! Notice that the values are tested as bits not as integers
       ! so sign bits in the integer are treated just like any other
       do i=-128,127,32
          byte=i
          write(*,’(sp,i0.4,*(1x,1l,1x,b0.8))’)i,ble(byte,64_int8),byte
          write(*,’(sp,i0.4,*(4x,b0.8))’)64_int8,64_int8
       enddo

! see the BGE() description for an extended description ! of related information

end program demo_ble

Results:

     >  -0128  F 10000000
     >  +0064    01000000
     >  -0096  F 10100000
     >  +0064    01000000
     >  -0064  F 11000000
     >  +0064    01000000
     >  -0032  F 11100000
     >  +0064    01000000
     >  +0000  T 00000000
     >  +0064    01000000
     >  +0032  T 00100000
     >  +0064    01000000
     >  +0064  T 01000000
     >  +0064    01000000
     >  +0096  F 01100000
     >  +0064    01000000

STANDARD

Fortran 2008

SEE ALSO

BGE(3), BGT(3), BLT(3)

Fortran intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 ble (3fortran) November 02, 2024
Generated by manServer 1.08 from 39c82313-afbb-4b68-9390-88f2c3e52662 using man macros.