mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-08 23:06:01 +02:00
* 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 -
This commit is contained in:
parent
c7213b7ff1
commit
636736dda6
@ -854,12 +854,12 @@ function hypot(x,y : float) : float;
|
|||||||
|
|
||||||
function log10(x : float) : float;
|
function log10(x : float) : float;
|
||||||
begin
|
begin
|
||||||
log10:=ln(x)/ln(10);
|
log10:=ln(x)*0.43429448190325182765; { 1/ln(10) }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function log2(x : float) : float;
|
function log2(x : float) : float;
|
||||||
begin
|
begin
|
||||||
log2:=ln(x)/ln(2)
|
log2:=ln(x)*1.4426950408889634079; { 1/ln(2) }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function logn(n,x : float) : float;
|
function logn(n,x : float) : float;
|
||||||
|
Loading…
Reference in New Issue
Block a user