79 lines
2.1 KiB
C#
79 lines
2.1 KiB
C#
using StgSharp;
|
|
using System;
|
|
using System.Diagnostics;
|
|
|
|
internal class Program
|
|
{
|
|
private unsafe static void Main(string[] args)
|
|
{
|
|
/*
|
|
int cc = 3;
|
|
Console.WriteLine(cc/2);
|
|
/**/
|
|
|
|
|
|
/*
|
|
Console.WriteLine(StgSharp.Math.Sin(1.06f));
|
|
/**/
|
|
|
|
/*
|
|
for (int wasd = 0; wasd < 100; wasd++)
|
|
{
|
|
float time = 1000000;
|
|
double a = 114514;
|
|
System.Diagnostics.Stopwatch stopwatch = new Stopwatch();
|
|
stopwatch.Start(); // 开始监视代码运行时间
|
|
for (float i = 2; i < time; i++)
|
|
{
|
|
a = StgSharp.Math.Tan(i);
|
|
}
|
|
stopwatch.Stop(); // 停止监视
|
|
TimeSpan timespan = stopwatch.Elapsed; // 获取当前实例测量得出的总时间
|
|
double milliseconds = timespan.TotalMilliseconds; // 总毫秒数
|
|
Console.WriteLine($"{milliseconds},{a}");
|
|
|
|
|
|
System.Diagnostics.Stopwatch stopwatch1 = new Stopwatch();
|
|
double b = 114514;
|
|
double time2 = time;
|
|
stopwatch1.Start();
|
|
for (double i = 2; i < time2; i++)
|
|
{
|
|
b = System.Math.Tan(i);
|
|
}
|
|
stopwatch1.Stop();
|
|
timespan = stopwatch1.Elapsed;
|
|
double milliseconds2 = timespan.TotalMilliseconds;
|
|
Console.WriteLine($"{milliseconds2},{b}");
|
|
Console.WriteLine("");
|
|
}
|
|
/**/
|
|
|
|
|
|
double accuracy = 0;
|
|
for (float i = 1f; i < 4000000; i += 1f)
|
|
{
|
|
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;
|
|
Console.WriteLine(i);
|
|
Console.WriteLine(ac);
|
|
Console.WriteLine(r1);
|
|
Console.WriteLine(r2);
|
|
Console.WriteLine("");
|
|
}
|
|
}
|
|
Console.WriteLine(accuracy);
|
|
/**/
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|