[ODE] Wrong brackets in definition of dSqrt in common.h ?
Peter Onion
Peter.Onion at btinternet.com
Tue Dec 13 15:30:05 MST 2005
On Tue, 2005-12-13 at 16:15 -0600, Rodrigo Hernandez wrote:
> That's a function-call style cast, acording to Wikipedia
> (http://en.wikipedia.org/wiki/Type_conversion) its the C++ way of doing
> type casting (though C style is still supported).
>
> I am curious as to what code does the preprocessor generates for dSqrt
> in AMD 64.
>
Using "gcc -E" the original version gave this .....
distance =
(((float)sqrtf(float(((posn3)[0]-(force3)[0])*((posn3)[0]-(force3)[0]) +
((posn3)[1]-(force3)[1])*((posn3)[1]-(force3)[1])
+ ((posn3)[2]-(force3)[2])*((posn3)[2]-(force3)[2])))));
My modified version produces this.....
distance =
(((float)sqrtf((float)(((posn3)[0]-(force3)[0])*((posn3)[0]-(force3)[0])
+ ((posn3)[1]-(force3)[1])*((posn3)[1]-(force3)[1]) +
((posn3)[2]-(force3)[2])*((posn3)[2]-(force3)[2])))));
I've not actually tried to run this yet as there are are other warnings
that I'm fixing in other (non-ode) bits of the code. I require a clean
compile with "-Wall" before I try to debug code.
Peter
More information about the ODE
mailing list