(j3.2006) BEQ, BNE?

Robert Corbett robert.corbett
Tue Jan 29 22:54:04 EST 2013


On 01/29/13 18:22, Van Snyder wrote:
> We did BLT, BLE, etc., but why not BEQ and BNE?
>
> One might be tempted to use == and /=, but these are required to fail
> for +/- zero on ones-complement and sign-magnitude machines because
> Fortran doesn't distinguish +0 from -0 for integers.
>
> Should we add BEQ and BNE, or suggest that users write something like
>
>    if ( BLE(I,J) .and. BLE(J,I) ) then ! I and J are equal bit strings
>      ....
>    end if
>
> or is there another way to do it that I've overlooked?

I prefer


       IF ( POPCNT(IEOR(I, J)) .EQ. 0) THEN ! I and J are equal bit strings

Bob Corbett





More information about the J3 mailing list