Division int32 numbers in MATLAB R2019b
조회 수: 4 (최근 30일)
이전 댓글 표시
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++?
댓글 수: 0
채택된 답변
vadim onuchin
2020년 10월 27일
편집: vadim onuchin
2020년 10월 27일
댓글 수: 2
Bruno Luong
2020년 10월 27일
Just wonder what is the risk to overload integer "/" with idivide?
Beside Image Proceesing toolbox where else does MATLAB stock uses integers?
추가 답변 (1개)
Cris LaPierre
2020년 10월 27일
편집: Cris LaPierre
2020년 10월 27일
int32 is for storing 32-bit integers. The result of the division is rounded to the closest integer value.
int32(32.5)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!