Is IDL's behaviour for "OR" operand OK for all operand types and sizes? --- And what should GDL do? #1782
Replies: 2 comments 3 replies
-
following https://www.nv5geospatialsoftware.com/docs/Bitwise_Operators.html for float : For floating- point operands, returns the first operand if it is non- zero, or the 2nd operand otherwise. furthermore : |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We believe we have tested ALL possible cases of ALL operands ( +, -, /, ... AND, OR, ... etc) on ALL IDL types and sizes.
The results match those of IDL (fortunately) except for OR (and its sibling XOR) in ONE case, and this case is problematic, hence this call for advice:
As of today, if A is a integer-type scalar, say, 33, and B is an integer-type array, say, indgen(10) we have:
and
So, same results.
However if A or B is of FLOAT TYPE, the operands are of float type, and the results differ between IDL and GDL:
So, with IDL, (A OR B) is NOT (B OR A) for floats. It is (A OR B[0]) replicated N_ELEMENTS(B). I would say that IDL is wrong in this case. What do you think?
(this is a niche case --- I wonder if there is code somewhere that falls in this special case, so I would tend to not change the GDL behaviour).
Beta Was this translation helpful? Give feedback.
All reactions