Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,47 +0,0 @@
|
|||
with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions;
|
||||
with Ada.Numerics.Long_Elementary_Functions; use Ada.Numerics.Long_Elementary_Functions;
|
||||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Eulers_Constant is
|
||||
|
||||
function Euler_Vacca (Iterations : Integer) return Long_Float is
|
||||
Gamma : Long_Float := 1.0;
|
||||
Term : Long_Float;
|
||||
Power : Long_Integer;
|
||||
Sign : Long_Float;
|
||||
begin
|
||||
Gamma := 0.5 - (1.0 / 3.0);
|
||||
for I in 2 .. Iterations loop
|
||||
Power := 2 ** Natural (I);
|
||||
Sign := -1.0;
|
||||
Term := 0.0;
|
||||
for Domin in Power .. (2 * Power - 1) loop
|
||||
Sign := - (Sign);
|
||||
Term := Term + Sign / Long_Float (Domin);
|
||||
end loop;
|
||||
Gamma := Gamma + (Long_Float (I) * Term);
|
||||
end loop;
|
||||
return Gamma;
|
||||
end Euler_Vacca;
|
||||
|
||||
-- Ada Float type is IEEE 754 32-bit, giving 9 decimal digits of precision
|
||||
Euler_Castellanos_Float : constant Float :=
|
||||
(((80.0 ** 3) + 92.0) /
|
||||
(61.0 ** 4)) ** (1.0 / 6.0);
|
||||
|
||||
-- Ada Long_Float type is IEEE 754 32-bit, giving 14 decimal digits of precision
|
||||
Euler_Castellanos_Long_Float : constant Long_Float :=
|
||||
(990.0 ** 3 - 55.0 ** 3 - 79.0 ** 2 - 16.0) /
|
||||
70.0 ** 5;
|
||||
|
||||
Iters : Integer;
|
||||
begin
|
||||
Put_Line ("Its. Vacca");
|
||||
Iters := 2;
|
||||
while Iters <= 32 loop
|
||||
Put_Line (Iters'Image & " " & Euler_Vacca (Iters)'Image);
|
||||
Iters := Iters + 2;
|
||||
end loop;
|
||||
Put_Line ("Castellanos approximation for standard Float (9 digits): " & Euler_Castellanos_Float'Image);
|
||||
Put_Line ("Castellanos approximation for Long Float (14 digits): " & Euler_Castellanos_Long_Float'Image);
|
||||
end Eulers_Constant;
|
||||
|
|
@ -18,22 +18,22 @@ var Euler,G,A,Error: double;
|
|||
var N: integer;
|
||||
const Correct =0.57721566490153286060651209008240243104215933593992;
|
||||
|
||||
procedure ShowEulerError(N: int64);
|
||||
{Show Euler number and Error}
|
||||
begin
|
||||
Euler:=ComputeEuler(N);
|
||||
Error:=Correct-Euler;
|
||||
Memo.Lines.Add('N = '+FloatToStrF(N,ffNumber,18,0));
|
||||
Memo.Lines.Add('Euler='+FloatToStrF(Euler,ffFixed,18,18));
|
||||
Memo.Lines.Add('Error='+FloatToStrF(Error,ffFixed,18,18));
|
||||
Memo.Lines.Add('');
|
||||
end;
|
||||
procedure ShowEulerError(N: int64);
|
||||
{Show Euler number and Error}
|
||||
begin
|
||||
Euler:=ComputeEuler(N);
|
||||
Error:=Correct-Euler;
|
||||
Memo.Lines.Add('N = '+FloatToStrF(N,ffNumber,18,0));
|
||||
Memo.Lines.Add('Euler='+FloatToStrF(Euler,ffFixed,18,18));
|
||||
Memo.Lines.Add('Error='+FloatToStrF(Error,ffFixed,18,18));
|
||||
Memo.Lines.Add('');
|
||||
end;
|
||||
|
||||
begin
|
||||
{Compute Euler number with iterations ranging 10 to 10^9}
|
||||
for N:=1 to 9 do
|
||||
begin
|
||||
ShowEulerError(Trunc(Power(10,N)));
|
||||
end;
|
||||
begin
|
||||
ShowEulerError(Trunc(Power(10,N)));
|
||||
end;
|
||||
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ fastfunc gethn n .
|
|||
.
|
||||
return hn
|
||||
.
|
||||
e = 2.718281828459045235
|
||||
n = 10e8
|
||||
numfmt 0 9
|
||||
print gethn n - log10 n / log10 e
|
||||
print gethn n - log n 0
|
||||
|
|
|
|||
|
|
@ -5,20 +5,20 @@
|
|||
*/
|
||||
public class EulerConstant {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(gamma(1_000_000));
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
System.out.println(gamma(1_000_000));
|
||||
}
|
||||
|
||||
private static double gamma(int N) {
|
||||
double gamma = 0.0;
|
||||
|
||||
for ( int n = 1; n <= N; n++ ) {
|
||||
gamma += 1.0 / n;
|
||||
}
|
||||
|
||||
gamma -= Math.log(N) + 1.0 / ( 2 * N );
|
||||
|
||||
return gamma;
|
||||
}
|
||||
|
||||
double gamma = 0.0;
|
||||
|
||||
for ( int n = 1; n <= N; n++ ) {
|
||||
gamma += 1.0 / n;
|
||||
}
|
||||
|
||||
gamma -= Math.log(N) + 1.0 / ( 2 * N );
|
||||
|
||||
return gamma;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
-- 28 Jul 2025
|
||||
include Settings
|
||||
-- 23 Aug 2025
|
||||
include Setting
|
||||
|
||||
say 'EULER-MASCHERONI CONSTANT'
|
||||
say 'Method Brent-McMillan'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue