is this the only way to cast from float to int?
Code:result_flt:single=math.ArcTan2(dy,dx); result_string2:string=floattostr(radtodeg(result_flt)); result_int2:integer=strtoint(result_string2); first:= result_int2+360; result:= first Mod 360;
is this the only way to cast from float to int?
Code:result_flt:single=math.ArcTan2(dy,dx); result_string2:string=floattostr(radtodeg(result_flt)); result_int2:integer=strtoint(result_string2); first:= result_int2+360; result:= first Mod 360;
lol, that's ridiculous! You shouldn't do that by casting to string and back. Way too exprensive.
Just have a look at the Round(), Floor() and Ceil() functions in the math unit:
Some good info can be found here:
http://www.delphibasics.co.uk/RTL.asp?Name=Round
Btw: I don't understand your syntax. You're doing this:
Is that even possible? Shouldn't it be?Code:result_flt:single=math.ArcTan2(dy,dx);
Code:var result_flt: single; begin result_flt := math.ArcTan2(dy,dx); end;
Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.
Bookmarks