08-16-2024, 11:45 PM
(This post was last modified: 08-16-2024, 11:46 PM by DSMan195276.)
You're seeing the difference between `/` division and `\` division. Basically, "regular" division turns both arguments into floating-point (`DOUBLE`) values before doing the division, and the result is another floating-point value. If you pass the expression directly to `Print` then you'll be printing the resulting `DOUBLE` value.
If you instead do `t4 = t2 / t1`separately and pass `t4` to `Print` then you'll always see an integer. The assignment of the value to `t4` turns the value back into an integer value. Alternatively, you can Print `t2 \ t1`, which will do integer division. Integer division does not turn either value into a floating-point value and will give you an integer result.
Separately you get Inf because you're doing a divide-by-zero, the `t1` variable is not shared with the `Sub`.
If you instead do `t4 = t2 / t1`separately and pass `t4` to `Print` then you'll always see an integer. The assignment of the value to `t4` turns the value back into an integer value. Alternatively, you can Print `t2 \ t1`, which will do integer division. Integer division does not turn either value into a floating-point value and will give you an integer result.
Separately you get Inf because you're doing a divide-by-zero, the `t1` variable is not shared with the `Sub`.