How we are getting overflow when single(-2) is stored in uint32?

2 vues (au cours des 30 derniers jours)
Nithinraj
Nithinraj le 20 Mai 2023
single (-2) to uint32
  5 commentaires
Star Strider
Star Strider le 20 Mai 2023
@Nithinraj — You need to mention that you are using Simulilnk.
Nithinraj
Nithinraj le 20 Mai 2023
I was getting the above error in uint32 block in simulink.

Connectez-vous pour commenter.

Réponse acceptée

Kshittiz
Kshittiz le 23 Mai 2023
Hi,
I understand that you are getting overflow when single(-2) is stored in uint32 block in Simulink.
In Simulink, an overflow error occurs when the value being assigned or stored in a block exceeds the maximum representable value for the specified data type. In your case, you're trying to store the value -2 in a uint32 block, which represents an unsigned 32-bit integer.
The uint32 data type can only store non-negative integers ranging from 0 to 4294967295. Since -2 is a negative value, it cannot be represented by the uint32 data type, resulting in an overflow error.
Thanks!

Plus de réponses (0)

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by