hedgewars/uFloat.pas
changeset 4900 8ad0e23e6d63
parent 4415 941251bad467
child 4976 088d40d8aba2
equal deleted inserted replaced
4899:8163c9aaad0c 4900:8ad0e23e6d63
   350 end;
   350 end;
   351 
   351 
   352 
   352 
   353 function AngleSin(const Angle: Longword): hwFloat;
   353 function AngleSin(const Angle: Longword): hwFloat;
   354 begin
   354 begin
   355 {$IFDEF DEBUGFILE}
       
   356 //TryDo((Angle >= 0) and (Angle <= 2048), 'Sin param exceeds limits', true);
   355 //TryDo((Angle >= 0) and (Angle <= 2048), 'Sin param exceeds limits', true);
   357 {$ENDIF}
       
   358 AngleSin.isNegative:= false;
   356 AngleSin.isNegative:= false;
   359 if Angle < 1024 then AngleSin.QWordValue:= SinTable[Angle]
   357 if Angle < 1024 then AngleSin.QWordValue:= SinTable[Angle]
   360                 else AngleSin.QWordValue:= SinTable[2048 - Angle]
   358                 else AngleSin.QWordValue:= SinTable[2048 - Angle]
   361 end;
   359 end;
   362 
   360 
   363 function AngleCos(const Angle: Longword): hwFloat;
   361 function AngleCos(const Angle: Longword): hwFloat;
   364 begin
   362 begin
   365 {$IFDEF DEBUGFILE}
       
   366 //TryDo((Angle >= 0) and (Angle <= 2048), 'Cos param exceeds limits', true);
   363 //TryDo((Angle >= 0) and (Angle <= 2048), 'Cos param exceeds limits', true);
   367 {$ENDIF}
       
   368 AngleCos.isNegative:= Angle > 1024;
   364 AngleCos.isNegative:= Angle > 1024;
   369 if Angle < 1024 then AngleCos.QWordValue:= SinTable[1024 - Angle]
   365 if Angle < 1024 then AngleCos.QWordValue:= SinTable[1024 - Angle]
   370                 else AngleCos.QWordValue:= SinTable[Angle - 1024]
   366                 else AngleCos.QWordValue:= SinTable[Angle - 1024]
   371 end;
   367 end;
   372 
   368