Is there another function in Fortran like `merge` that does not evaluate its arguments?

From a user’s perspective, I would expect the compiler to choose the fastest option considering that the semantics of merge allow to evaluate both expressions.

As a side note: np.where from NumPy also evaluates both expressions:

np.where([True,False],1/np.array([1,0]),np.array([1,1]))

has a valid result ((1.0,1.0)) but give a divide by zero encountered in divide warning.

1 Like