hedgewars/uFloat.pas
changeset 355 40c68869899e
parent 351 29bc9c36ad5f
child 357 165a040e4cfa
equal deleted inserted replaced
354:60e4af0a4375 355:40c68869899e
   169 
   169 
   170 operator * (z1: hwFloat; z2: LongInt) z : hwFloat;
   170 operator * (z1: hwFloat; z2: LongInt) z : hwFloat;
   171 begin
   171 begin
   172 z.isNegative:= z1.isNegative xor (z2 < 0);
   172 z.isNegative:= z1.isNegative xor (z2 < 0);
   173 z2:= abs(z2);
   173 z2:= abs(z2);
   174 z.QWordValue:= z.QWordValue * z2
   174 z.QWordValue:= z1.QWordValue * z2
   175 end;
   175 end;
   176 
   176 
   177 operator / (z1, z2: hwFloat) z : hwFloat;
   177 operator / (z1, z2: hwFloat) z : hwFloat;
   178 var t: hwFloat;
   178 var t: hwFloat;
   179 begin
   179 begin
   258 end;
   258 end;
   259 
   259 
   260 function AngleSin(angle: Longword): hwFloat;
   260 function AngleSin(angle: Longword): hwFloat;
   261 begin
   261 begin
   262 AngleSin.isNegative:= false;
   262 AngleSin.isNegative:= false;
   263 AngleSin:= Round(Sin(Angle * pi / cMaxAngle) * 4294967296)
   263 AngleSin.QWordValue:= Round(Sin(Angle * pi / cMaxAngle) * 4294967296)
   264 end;
   264 end;
   265 
   265 
   266 function AngleCos(angle: Longword): hwFloat;
   266 function AngleCos(angle: Longword): hwFloat;
   267 var CosVal: Extended;
   267 var CosVal: Extended;
   268 begin
   268 begin
   269 CosVal:= Cos(Angle * pi / cMaxAngle);
   269 CosVal:= Cos(Angle * pi / cMaxAngle);
   270 AngleCos.isNegative:= CosVal < 0;
   270 AngleCos.isNegative:= CosVal < 0;
   271 AngleCos:= Round(Cosval * 4294967296)
   271 AngleCos.QWordValue:= Round(Abs(Cosval) * 4294967296)
   272 end;
   272 end;
   273 
   273 
   274 {$ENDIF}
   274 {$ENDIF}
   275 
   275 
   276 end.
   276 end.