Saturday, May 22, 2010

What is the C-code for the floor(x) function?

I just want to know the statements that are within the fucntion not how to use the function.





thank you in advance

What is the C-code for the floor(x) function?
I dont have the actual code, I'd write it like this -





float floor (float x)


{


return (float) (x %26lt; 0.f ? ((int) x) - 1) : (int) x);


}





But given how small it is I'd probably use a macro.
Reply:#include %26lt;math.h%26gt;


floor(x)


No comments:

Post a Comment