how can I know which data types I need precisely?

1 view (last 30 days)
SimTec
SimTec on 24 Jun 2021
I have simulated a PI controller in simulink in double precision format, as the showed picture:
and then when I change the addition and multiplication to single precision 32bit, I got a slight error around 100mv difference between the target and the output.
again, I have implemented the controller in DSP in C code and the there I used single precision. so my question is how to know if the single precision is enough or the double precision is needed? I meanfor me when I look at the single precision seems enough in term of precision but the outcome is slighlty difference also in DSP compared to double precision in Simulink.
I know it is a stupid question, I looked on the net the difference and it shows not so much on which one to choose.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by