hedgewars/uFloat.pas
changeset 8916 71485c03a507
parent 8915 36e1574e989d
child 8917 263f2a8475bc
--- a/hedgewars/uFloat.pas	Wed Apr 17 12:11:33 2013 +0400
+++ b/hedgewars/uFloat.pas	Wed Apr 17 15:45:13 2013 +0400
@@ -318,19 +318,18 @@
 z.isNegative:= z1.isNegative xor z2.isNegative;
 z.Round:= z1.QWordValue div z2.QWordValue;
 t:= z1 - z2 * z.Round;
-if t.QWordValue = 0 then
-    z.Frac:= 0
-else
+z.Frac:= 0;
+
+if t.QWordValue <> 0 then
     begin
-    while ((t.QWordValue and $8000000000000000) = 0) and ((z2.QWordValue and $8000000000000000) = 0) do
+    while ((t.QWordValue and $FF00000000000000) = 0) and ((z2.QWordValue and $FF00000000000000) = 0) do
         begin
-        t.QWordValue:= t.QWordValue shl 1;
-        z2.QWordValue:= z2.QWordValue shl 1
+        t.QWordValue:= t.QWordValue shl 8;
+        z2.QWordValue:= z2.QWordValue shl 8
         end;
+        
     if z2.Round > 0 then
-        z.Frac:= (t.QWordValue) div (z2.Round)
-    else
-        z.Frac:= 0
+        inc(z.QWordValue, t.QWordValue div z2.Round);
     end
 end;