working with CW 6.1 and a MC13213 i ran into problems with the floatingLib.
I constructed a snippet that brings up the kind of problem. (even in the true-time-simulation)
I calculate x3 = (2.5e-11) - (1.7e-20)*(1.7e-20).
and would expect one of the following:
2.5e-11 (plus minus some rounding error), or NaN, or +Inf , or -Inf.
But I get: x3==-3.34...e+37
And this is not conform to IEEE 754 as far as i can see.
I already tried using a Service Request, but it got closed.
And i have no solution to the problem yet.
Q1: are you able to reproduce the behavior?
Q2: can you understand, why i expect a different result?
Q3: is this conform to IEEE in your opinion?
Q4: do you know a solution?
Aswers to any of these Questions is welcome.
volatile float x1;
volatile float x2a;
volatile float x2;
volatile float x3;
x1=2.5e-11; /** this is within normalized range **/
x2a=1.7e-20; /** this is within normalized range **/
x2 = x2a*x2a; /** this is within denormalized IEEE754
x3=x1-x2; /** this goes wrong i think **/
while( x3<0 ); /** this halts, but should not **/