Division int32 numbers in MATLAB R2019b
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
vadim onuchin
il 27 Ott 2020
Commentato: Steven Lord
il 27 Ott 2020
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 Commenti
Risposta accettata
vadim onuchin
il 27 Ott 2020
Modificato: vadim onuchin
il 27 Ott 2020
2 Commenti
Bruno Luong
il 27 Ott 2020
Just wonder what is the risk to overload integer "/" with idivide?
Beside Image Proceesing toolbox where else does MATLAB stock uses integers?
Più risposte (1)
Cris LaPierre
il 27 Ott 2020
Modificato: Cris LaPierre
il 27 Ott 2020
int32 is for storing 32-bit integers. The result of the division is rounded to the closest integer value.
int32(32.5)
0 Commenti
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!