hedgewars/uFloat.pas
changeset 7623 addc5b262617
parent 7614 3ae60c8a15f2
child 7624 03d662ff9c41
equal deleted inserted replaced
7622:172fb1c7615b 7623:addc5b262617
   267     begin
   267     begin
   268     z.isNegative:= z1.isNegative;
   268     z.isNegative:= z1.isNegative;
   269     z.QWordValue:= z1.QWordValue + z2.QWordValue
   269     z.QWordValue:= z1.QWordValue + z2.QWordValue
   270     end
   270     end
   271 end;
   271 end;
       
   272 
       
   273 function isZero(const z: hwFloat): boolean; inline; 
       
   274 begin
       
   275 isZero := z.QWordValue = 0;
       
   276 end;
   272 {$ENDIF}
   277 {$ENDIF}
   273 {$IFDEF WEB}
   278 {$IFDEF WEB}
   274 (*
   279 (*
   275     Mostly to be kind to JS as of 2012-08-27 where there is no int64/uint64.  This may change though.
   280     Mostly to be kind to JS as of 2012-08-27 where there is no int64/uint64.  This may change though.
   276 *)
   281 *)
   340     z:= z1;
   345     z:= z1;
   341     z.Frac:= z.Frac + z2.Frac;
   346     z.Frac:= z.Frac + z2.Frac;
   342     z.Round:= z.Round + z2.Round;
   347     z.Round:= z.Round + z2.Round;
   343     if z.Frac<z1.Frac then inc(z.Round)
   348     if z.Frac<z1.Frac then inc(z.Round)
   344     end
   349     end
       
   350 end;
       
   351 
       
   352 function isZero(const z: hwFloat): boolean; inline; 
       
   353 begin
       
   354 isZero := z.Round = 0 and z.Frac = 0;
   345 end;
   355 end;
   346 {$ENDIF}
   356 {$ENDIF}
   347 
   357 
   348 operator - (const z1: hwFloat) z : hwFloat;
   358 operator - (const z1: hwFloat) z : hwFloat;
   349 begin
   359 begin
   542 if Angle < 1024 then
   552 if Angle < 1024 then
   543     AngleCos.QWordValue:= SinTable[1024 - Angle]
   553     AngleCos.QWordValue:= SinTable[1024 - Angle]
   544 else
   554 else
   545     AngleCos.QWordValue:= SinTable[Angle - 1024]
   555     AngleCos.QWordValue:= SinTable[Angle - 1024]
   546 end;
   556 end;
   547 
       
   548 function isZero(const z: hwFloat): boolean; inline; 
       
   549 begin
       
   550 isZero := z.QWordValue = 0;
       
   551 end;
       
   552 {$ENDIF}
   557 {$ENDIF}
   553 
   558 
   554 end.
   559 end.