MATLAB believes that "uint8(1) / 2" equals 1 and mod(uint8(1),2) equals 1 as well. It does not make any sense to me. I believe that general rule of integer arithmetics is "a equals (a/b)*b + a mod b", so usually "uint8(1) / 2" is 0. It is certainly so in C/C++ and FORTRAN, I do not really recall any language where it is different. Why is it 1 in MATLAB?
MATLAB: How come “uint8(1) / 2” equals 1
integer arithmeticsMATLABuint8
Best Answer