diff -r 6b314e907f6d -r 7a9663194767 hedgewars/uFloat.pas --- a/hedgewars/uFloat.pas Sun Jan 20 22:17:03 2008 +0000 +++ b/hedgewars/uFloat.pas Sun Jan 20 22:53:46 2008 +0000 @@ -130,7 +130,7 @@ {$ENDIF} implementation -uses uConsts; +uses uConsts, uMisc; {$IFDEF FPC} @@ -286,12 +286,22 @@ c: hwFloat; begin hwSqrt.isNegative:= false; -l:= 0; -r:= t.QWordValue div 2 + 1; + +if t.Round = 0 then + begin + l:= t.QWordValue; + r:= $100000000 + end else + begin + l:= $100000000; + r:= t.QWordValue + end; + repeat c.QWordValue:= (l + r) div 2; if hwSqr(c).QWordValue > t.QWordValue then r:= c.QWordValue else l:= c.QWordValue until r - l <= 1; + hwSqrt.QWordValue:= l end;