1

I am trying to compute weakest precondition of a particular function which requires sqrtf() function call. Here is a segment from my code-

void func(float err1_10, float err2_10){
float x1_00,......,x20_00;
float x1_10,......,x20_10;  
float x_mkfirm1,x_mkfirm2;  
float dist_00=0, dist_10=5, a00=0, a01=0, a10=-100, a11=0, b00=100,b10=0, u=2;
................................  
................................  
................................
x20_00=a00*x19_00+a01*x19_10+u*b00;  
x20_10=a10*x19_00+a11*x19_10+u*b10;  
x_mkfirm1=sqrtf((x20_00*x20_00)+(x20_10*x20_10));  
x_mkfirm2=sqrtf((x0_00*x0_00)+(x0_10*x0_10));  
//@ assert P: (x_mkfirm1/x_mkfirm2 >= 1) ;  
}     

I have included "math.h". Whenever I am running the wp plugin it shows- frama-c-in.c:3:[kernel] warning: Neither code nor specification for function sqrtf, generating default assigns from the prototype. It is also not generating weakest precondition for this particular assert.
Also I am trying to use a negative float value (-0.4007) for a variable. It is showing me the following error: Floating-point constant 0.4007 is not represented exactly.

D.L.
  • 169
  • 3
  • 17
  • 3
    The “Floating-point constant 0.4007 is not represented exactly.” warning is only reminding you that the value in the program is not 4007/10000, but the closest representable `double` to that. This is obvious and could have been omitted, but at the same time it is a common source of confusion when trying to reason about programs that use floating-point. – Pascal Cuoq Apr 02 '16 at 08:56
  • So it will not create any problem while generating the weakest precondition in general. Thank you! – D.L. Apr 02 '16 at 11:46

0 Answers0