Update `BinOp.chpl` to only cast when necessary
Part of a question in #1623
There are places in BinOp.chpl where we cast before doing an operation in order to support type combos that chapel doesn't natively. But there are also places where this cast isn't necessary because chapel already does what we need. We should go through and test these cases and only cast when necessary and add comments detailing those cases
Example of when we need to cast:
There are some cases that arkouda supports (because numpy supports them) that chapel doesn't natively. The easiest example is uint+int, it isn't clear what the return type should be
Numpy handles this by returning a float:
>>> np.uint(5) + 3
8.0
Chapel throws an error:
module PlayingAround {
proc main () throws {
var u: uint = 5;
var i: int = 3;
writeln(u+i);
}
}
$ chpl -o playing PlayingAround.chpl
PlayingAround.chpl:3: In function 'main':
PlayingAround.chpl:6: error: illegal use of '+' on operands of type uint(64) and signed integer
So the way to be consistent with numpy is to cast to real before the operation
https://github.com/Bears-R-Us/arkouda/blob/14d98cc479af4ea456021fdeb8642502f83e5434/src/BinOp.chpl#L247-L252