Polyspace Code Prover (R2014b) - Float32 Overflow due to static local variables
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I have the following code function. When I check the code with Polyspace Code Prover (R2014b), I get an "orange" Overflow in the formula (*1) due to the static local variable "X_Sa2_LPF_UnitDelay" that is assumed with the full float32 range (-3.4029E+38 .. 3.4029E+38). But by the algorithem (low-pass-filter) the variable value can not larger as the Value of input "Sa1_InRaw". The Input "Sa1_InRaw" is limited by DRS to +/-50. "Sa1_Constant" is a constant with a also fixed range.
Can I limit static local variables in the configuration? Can I avoid this overflow by any other option?
float Sa1_InRaw;
float Sa1_OutFilt;
const float Sa1_Constant = 0.3F;
void Sa3_LPF1(void) {
float Sa2_LPF_Add;
static float X_Sa2_LPF_UnitDelay = 0.F;
Sa2_LPF_Add = ((Sa1_InRaw - X_Sa2_LPF_UnitDelay) * Sa1_Constant) + X_Sa2_LPF_UnitDelay; //(*1)
X_Sa2_LPF_UnitDelay = Sa2_LPF_Add;
Sa1_OutFilt = Sa2_LPF_Add;
}
Thanks in advance! Best Regards, Thomas
0 commentaires
Réponses (3)
Alexandre De Barros
le 31 Mar 2017
Hello Thomas,
I've tried your code snippet with the version R2016b and everything is green (and X_Sa2_LPF_UnitDelay is not full-range).
Could you try with this version R2016b or R2017a, the last version?
If it's still orange, please contact the technical support, and attach the verification log to your request.
Best regards,
Alex
0 commentaires
Manuel Duss
le 28 Fév 2018
Hi together,
we´ve got the same problem like thomas. But we have to use Polyspace 2015b. Did anybody have a solution for this?
Thanks!
Best Regards Manuel
0 commentaires
Voir également
Catégories
En savoir plus sur Troubleshooting in Polyspace Products for Ada 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!