why can't i get sqrt of a raise into a float ?

 

i have this :

float max_distance=MathSqrt((float)MathPow(((float)px_per_side+1),2.0)*2.0);  

and it raises this error :

but it accepts it like this :

float max_distance=0.0;
//float max_distance=MathSqrt((float)MathPow(((float)px_per_side+1),2.0)*2.0);  
double _mdd=MathSqrt(MathPow(((double)px_per_side+1),2.0)*2);
max_distance=(float)_mdd; 

what am i doing wrong ?

 
  1. Lorentzos Roussos: what am i doing wrong ?

    It doesn't know whether 2.0 is a float or a double. You have MathSqrt( float, 2.0 ).

  2. Your code
    ((double)px_per_side+1)
    Simplified
    double(px_per_side+1)
 
William Roeder #:
  1. It doesn't know whether 2.0 is a float or a double. You have MathSqrt( float, 2.0 ).

  2. Your code
    Simplified

ow it accepted this

float max_distance=(float)MathSqrt(MathPow(((float)px_per_side+1),(float)2.0)*2.0); 

thank you