MATLAB: Division int32 numbers in MATLAB R2019b

bugsMATLAB

Let's see some examples:
first:
1140 / 32
ans =
35.6250
second:
int32(1140) / int32(32)
ans =
int32
36
third:
int32(1140 / 32)
ans =
int32
36
So, why division with int32 numbers is not equivalent like in C++?

Best Answer

So, I found solution.
Need to use special division:
idivide(int32(1140), int32(32))
ans =
int32
35