hedgewars/uFloat.pas
changeset 6775 22b5fb7217db
parent 6700 e04da46ee43c
child 6785 a8aa5984185f
equal deleted inserted replaced
6774:237b96f06aae 6775:22b5fb7217db
    87 function DistanceI(const dx, dy: LongInt): hwFloat; // Same as above for integer parameters.
    87 function DistanceI(const dx, dy: LongInt): hwFloat; // Same as above for integer parameters.
    88 function AngleSin(const Angle: Longword): hwFloat;
    88 function AngleSin(const Angle: Longword): hwFloat;
    89 function AngleCos(const Angle: Longword): hwFloat;
    89 function AngleCos(const Angle: Longword): hwFloat;
    90 function SignAs(const num, signum: hwFloat): hwFloat; inline; // Returns an hwFloat with the value of parameter num and the sign of signum.
    90 function SignAs(const num, signum: hwFloat): hwFloat; inline; // Returns an hwFloat with the value of parameter num and the sign of signum.
    91 function hwSign(r: hwFloat): LongInt; inline; // Returns an integer with value 1 and sign of parameter r.
    91 function hwSign(r: hwFloat): LongInt; inline; // Returns an integer with value 1 and sign of parameter r.
       
    92 function hwSign(r: real): LongInt; inline; // Returns an integer with value 1 and sign of parameter r.
    92 function isZero(const z: hwFloat): boolean; inline;
    93 function isZero(const z: hwFloat): boolean; inline;
    93 {$IFDEF FPC}
    94 {$IFDEF FPC}
    94 {$J-}
    95 {$J-}
    95 {$ENDIF}
    96 {$ENDIF}
    96 {$WARNINGS OFF}
    97 {$WARNINGS OFF}
   407     hwSign:= -1
   408     hwSign:= -1
   408 else
   409 else
   409     hwSign:= 1
   410     hwSign:= 1
   410 end;
   411 end;
   411 
   412 
       
   413 function hwSign(r: real): LongInt;
       
   414 begin
       
   415 if r < 0 then
       
   416     hwSign:= -1
       
   417 else
       
   418     hwSign:= 1
       
   419 end;
       
   420 
   412 
   421 
   413 function AngleSin(const Angle: Longword): hwFloat;
   422 function AngleSin(const Angle: Longword): hwFloat;
   414 begin
   423 begin
   415 //TryDo((Angle >= 0) and (Angle <= 2048), 'Sin param exceeds limits', true);
   424 //TryDo((Angle >= 0) and (Angle <= 2048), 'Sin param exceeds limits', true);
   416 AngleSin.isNegative:= false;
   425 AngleSin.isNegative:= false;