Polyspace Code Prover (R2014b) - Float32 Overflow due to static local variables
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(3 个)
Alexandre De Barros
2017-3-31
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 个评论
Manuel Duss
2018-2-28
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Troubleshooting in Polyspace Products for Ada 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!