Why does the generated code for the Data Type Conversion block perform temporary up-conversion to type double when I am using other data types in Real-Time Workshop Embedded Coder 5.0 (R2007b)?
Afficher commentaires plus anciens
I have a model with the Data Type Conversion block which converts an input signal of type single to type int16. The Data Type Conversion block has the 'Round integer calculations toward' field set to 'Floor' in the Data Type Conversion Block Parameters dialog box.
The code generated for the above model using Real-Time Workshop Embedded Coder 5.0 (R2007b) is:
real_T tmp;
tmp = floor((real_T)mytest_U.In1);
mytest_Y.Out1 = (int16_T)(tmp <= 32767.0 ? tmp >= -32768.0 ? tmp : -32768.0 :32767.0);
Here, the input is temporarily cast to a double-precision data type. However, I would like all the calculations to be done using the single-precision data type.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Deployment, Integration, and Supported Hardware dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!