Sin, cos, tan added

This commit is contained in:
Nitload
2023-01-24 01:40:37 +08:00
parent 4c5dfb4828
commit 05869ac0ae
28 changed files with 120 additions and 15 deletions
+12 -12
View File
@@ -11,14 +11,12 @@ internal class Program
Console.WriteLine(cc/2);
/**/
/*
float aa = 261.2776027f;
uint bb = *(uint*)&aa;
Console.WriteLine(Convert.ToString(bb,toBase:2));
Console.WriteLine(StgSharp.Math.Log(3.5f));
Console.WriteLine(StgSharp.Math.Sin(1.06f));
/**/
/*
for (int wasd = 0; wasd < 100; wasd++)
{
float time = 1000000;
@@ -27,7 +25,7 @@ internal class Program
stopwatch.Start(); // 开始监视代码运行时间
for (float i = 2; i < time; i++)
{
a = StgSharp.Math.Log(i);
a = StgSharp.Math.Tan(i);
}
stopwatch.Stop(); // 停止监视
TimeSpan timespan = stopwatch.Elapsed; // 获取当前实例测量得出的总时间
@@ -41,7 +39,7 @@ internal class Program
stopwatch1.Start();
for (double i = 2; i < time2; i++)
{
b = System.Math.Log(i);
b = System.Math.Tan(i);
}
stopwatch1.Stop();
timespan = stopwatch1.Elapsed;
@@ -51,13 +49,13 @@ internal class Program
}
/**/
/*
double accuracy = 0;
for (float i = 1.001f; i < 4; i += 0.001f)
for (float i = 1f; i < 4000000; i += 1f)
{
double r1 = StgSharp.Math.Log(i);
double r2 = System.Math.Log(i);
double ac = ( System.Math.Max(r1,r2)- System.Math.Min(r1, r2) ) / System.Math.Max(r1, r2);
double r1 = StgSharp.Math.Sin(i);
double r2 = System.Math.Sin(i * ( 2 * System.Math.PI) / 360);
double ac = ( System.Math.Max(r1,r2)- System.Math.Min(r1, r2) ) / r2;
if (ac>accuracy)
{
accuracy = ac;
@@ -70,6 +68,8 @@ internal class Program
}
Console.WriteLine(accuracy);
/**/
}