I haven’t been able to find these rules on a website, (surely because I’m googling the wrong thing) so I’m asking here.
Dividing an int by an int and storing in a double always stores the rounded integer first. The only way I’ve been able to find to make it work is to cast both values to a double before doing the divide. There’s got to be a better way.
Also, where are the rules for the return types?
In an programming language, there are 2 types of operations:
If the 2 operands are of Integer type, the Integer operation is executed.
If ANYONE of the 2 operands is of Floating Point, the Floating Point Operation is exectued.
THUS: