Division int32 numbers in MATLAB R2019b
2 ビュー (過去 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!