Am I missing something, or is the Tip wrong?
Show older comments
I am looking to optimize my code for execution speed. (Embedded coder, simulink)
This option has bothered me for quite some time though, as I have seen mixed results from ticking and unticking "Saturate on integer overflow" in all different types of Simulink blocks.
According to the Tip, as seen of the left, the code efficiency is supposed to increase when I untick this box. However, as unticking the box results in a fmodf (modulous) function call being generated with the box unticked, I am really confused by the statement that this option should be unticked for optimized code efficiency. When the box is ticked, the generated code will still have the same range check, but the result of being out of range is simply that the value gets saturated at the maximum value for that specific datatype (instead of wrapping via modulous function).
so... is the 'Tip' simply wrong, or am I missing something?

Accepted Answer
More Answers (0)
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!