فهرست منبع

* log2() and log10(): replaced division by ln(base) with multiplication by reciprocal constant, this executes faster and somehow provides slightly better accuracy.

git-svn-id: trunk@26086 -
sergei 11 سال پیش
والد
کامیت
636736dda6
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      rtl/objpas/math.pp

+ 2 - 2
rtl/objpas/math.pp

@@ -854,12 +854,12 @@ function hypot(x,y : float) : float;
 
 function log10(x : float) : float;
   begin
-     log10:=ln(x)/ln(10);
+    log10:=ln(x)*0.43429448190325182765;  { 1/ln(10) }
   end;
 
 function log2(x : float) : float;
   begin
-     log2:=ln(x)/ln(2)
+    log2:=ln(x)*1.4426950408889634079;    { 1/ln(2) }
   end;
 
 function logn(n,x : float) : float;