How come "uint8(1) / 2" equals 1?
Show older comments
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?
1 Comment
Stephen23
on 19 Sep 2017
" Why is it 1 in MATLAB?"
Ask Cleve Moler.
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!