(j3.2006) BEQ, BNE?
Van Snyder
Van.Snyder
Tue Jan 29 23:24:17 EST 2013
On Tue, 2013-01-29 at 19:54 -0800, Robert Corbett wrote:
> 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
Sounds more expensive than BEQ(I,J) would be on architectures that can
do an unsigned integer compare but don't have a fast POPCNT.
> Bob Corbett
>
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
More information about the J3
mailing list