How we are getting overflow when single(-2) is stored in uint32?
古いコメントを表示
single (-2) to uint32
5 件のコメント
What are you doing?
This is what I get —
v = single(-2)
vu32 = uint32(v)
vi32 = int32(v)
.
Nithinraj
2023 年 5 月 20 日
Dyuman Joshi
2023 年 5 月 20 日
The "u" in the uint32 stands for unsigned, which means that this data-type supports only positive integers, along with 0.
If you want to convert a negative floating point integer to an integer data type, use signed integer classes, As @Star Strider has showed above (int8, int16, int32, int64)
Star Strider
2023 年 5 月 20 日
@Nithinraj — You need to mention that you are using Simulilnk.
Nithinraj
2023 年 5 月 20 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Signal Attributes and Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!