Has anybody else stumbled upon the following oddity? :
I was trying out a kind of branchless arithmetic operation such as
A = B*( d >= e ) + C*( f<=g ) !> this is something you can do in python and wanted to try out
With intel and nvfortran this is actually allowed BUT with gfortran such statement would produce a compile error such as ‘Error: Operands of binary numeric operator ‘*’ at (1) are INTEGER(4)/LOGICAL(4)’
Ok, be it, lets find a work around! —> transfer !
A = B* transfer( d >= e ,1 ) + C * transfer( f<=g , 1)
And then, one finds that
ifort : transfer(.true.,1) = -1
nvfortran : transfer(.true.,1) = -1
gfortran : transfer(.true.,1) = 1
My oh my …
Does any body knows if on the gfortran side there is any plans to supporting this kind of statements : A = B*( d >= e ) + C*( f<=g ) ?
And, well, does someone know, how to justify that “-1” ?? this was really shocking.