hedgewars/uFloat.pas
changeset 1433 4af291d5d79c
parent 1124 1636a3c7c061
child 1586 2c6f1d1f43c1
--- a/hedgewars/uFloat.pas	Mon Oct 27 21:01:18 2008 +0000
+++ b/hedgewars/uFloat.pas	Tue Oct 28 18:42:21 2008 +0000
@@ -99,6 +99,7 @@
            _0_93: hwFloat = (isNegative: false; QWordValue:  3994319585);
            _0_96: hwFloat = (isNegative: false; QWordValue:  4123168604);
           _0_995: hwFloat = (isNegative: false; QWordValue:  4273492459);
+          _0_998: hwFloat = (isNegative: false; QWordValue:  4294967296);
           _0_999: hwFloat = (isNegative: false; QWordValue:  4290672328);
             _1_9: hwFloat = (isNegative: false; QWordValue:  8160437862);
               _0: hwFloat = (isNegative: false; QWordValue:           0);
@@ -278,9 +279,11 @@
 
 function hwSqr(const t: hwFloat): hwFloat;
 begin
-hwSqr.isNegative:=false;
-hwSqr.QWordValue:= QWord(t.Round) * t.Frac * 2 + ((QWord(t.Frac) * t.Frac) shr 32);
-hwSqr.Round:= hwSqr.Round + t.Round * t.Round
+hwSqr.isNegative:= false;
+hwSqr.QWordValue:=
+	  ((QWord(t.Round) * t.Round) shl 32)
+	+ QWord(t.Round) * t.Frac * 2
+	+ ((QWord(t.Frac) * t.Frac) shr 32);
 end;
 
 function hwSqrt(const t: hwFloat): hwFloat;