Przeglądaj źródła

* patch by Rika for ArcTan2 to reduce code size

florian 3 lat temu
rodzic
commit
306559667c
1 zmienionych plików z 9 dodań i 10 usunięć
  1. 9 10
      rtl/objpas/math.pp

+ 9 - 10
rtl/objpas/math.pp

@@ -915,17 +915,16 @@ function arctan2(y,x : float) : float;
         else
           result:=-pi/2;
       end
-    else 
+    else
       begin
-        if X > 0 then
-          result:=ArcTan(y/x)
-        else
-          if Y < 0.0 then
-            result:=ArcTan(y/x)-pi
-          else          
-            result:=ArcTan(y/x)+pi;
-      end;              
-  end;  
+        result:=ArcTan(y/x);
+        if x<0 then
+          if y<0 then
+            result:=result-pi
+          else
+            result:=result+pi;
+      end;
+  end;
 {$endif FPC_MATH_HAS_ARCTAN2}