diff --git a/源代码/.Net/.vs/ProjectEvaluation/stgsharp.metadata.v5.1 b/源代码/.Net/.vs/ProjectEvaluation/stgsharp.metadata.v5.1 index d8ecd077..607355d2 100644 Binary files a/源代码/.Net/.vs/ProjectEvaluation/stgsharp.metadata.v5.1 and b/源代码/.Net/.vs/ProjectEvaluation/stgsharp.metadata.v5.1 differ diff --git a/源代码/.Net/.vs/ProjectEvaluation/stgsharp.projects.v5.1 b/源代码/.Net/.vs/ProjectEvaluation/stgsharp.projects.v5.1 index df8fca1c..61666336 100644 Binary files a/源代码/.Net/.vs/ProjectEvaluation/stgsharp.projects.v5.1 and b/源代码/.Net/.vs/ProjectEvaluation/stgsharp.projects.v5.1 differ diff --git a/源代码/.Net/.vs/StgSharp/DesignTimeBuild/.dtbcache.v2 b/源代码/.Net/.vs/StgSharp/DesignTimeBuild/.dtbcache.v2 index 341d85b1..8e632535 100644 Binary files a/源代码/.Net/.vs/StgSharp/DesignTimeBuild/.dtbcache.v2 and b/源代码/.Net/.vs/StgSharp/DesignTimeBuild/.dtbcache.v2 differ diff --git a/源代码/.Net/.vs/StgSharp/FileContentIndex/1bfba6c5-057b-4d30-8461-13dbc9faedfc.vsidx b/源代码/.Net/.vs/StgSharp/FileContentIndex/1bfba6c5-057b-4d30-8461-13dbc9faedfc.vsidx new file mode 100644 index 00000000..90e2a1b7 Binary files /dev/null and b/源代码/.Net/.vs/StgSharp/FileContentIndex/1bfba6c5-057b-4d30-8461-13dbc9faedfc.vsidx differ diff --git a/源代码/.Net/.vs/StgSharp/FileContentIndex/779698a7-0efa-4d06-bc13-5546cd7381a4.vsidx b/源代码/.Net/.vs/StgSharp/FileContentIndex/779698a7-0efa-4d06-bc13-5546cd7381a4.vsidx deleted file mode 100644 index 0712044d..00000000 Binary files a/源代码/.Net/.vs/StgSharp/FileContentIndex/779698a7-0efa-4d06-bc13-5546cd7381a4.vsidx and /dev/null differ diff --git a/源代码/.Net/.vs/StgSharp/FileContentIndex/e13476fa-fd43-4622-a0c7-42b5dbf5ceac.vsidx b/源代码/.Net/.vs/StgSharp/FileContentIndex/816f889f-f226-4917-8218-bef06f522086.vsidx similarity index 77% rename from 源代码/.Net/.vs/StgSharp/FileContentIndex/e13476fa-fd43-4622-a0c7-42b5dbf5ceac.vsidx rename to 源代码/.Net/.vs/StgSharp/FileContentIndex/816f889f-f226-4917-8218-bef06f522086.vsidx index f987790f..5751769d 100644 Binary files a/源代码/.Net/.vs/StgSharp/FileContentIndex/e13476fa-fd43-4622-a0c7-42b5dbf5ceac.vsidx and b/源代码/.Net/.vs/StgSharp/FileContentIndex/816f889f-f226-4917-8218-bef06f522086.vsidx differ diff --git a/源代码/.Net/.vs/StgSharp/FileContentIndex/8c69db66-6103-441b-b3a2-7bb083874a8c.vsidx b/源代码/.Net/.vs/StgSharp/FileContentIndex/8c69db66-6103-441b-b3a2-7bb083874a8c.vsidx deleted file mode 100644 index 2afac28d..00000000 Binary files a/源代码/.Net/.vs/StgSharp/FileContentIndex/8c69db66-6103-441b-b3a2-7bb083874a8c.vsidx and /dev/null differ diff --git a/源代码/.Net/.vs/StgSharp/FileContentIndex/8ee11e32-01e4-4327-b2a8-6001ee799e4b.vsidx b/源代码/.Net/.vs/StgSharp/FileContentIndex/8ee11e32-01e4-4327-b2a8-6001ee799e4b.vsidx new file mode 100644 index 00000000..9dfdae51 Binary files /dev/null and b/源代码/.Net/.vs/StgSharp/FileContentIndex/8ee11e32-01e4-4327-b2a8-6001ee799e4b.vsidx differ diff --git a/源代码/.Net/.vs/StgSharp/FileContentIndex/8fbcd803-fe1a-4a0a-8305-805ae0d96726.vsidx b/源代码/.Net/.vs/StgSharp/FileContentIndex/8fbcd803-fe1a-4a0a-8305-805ae0d96726.vsidx new file mode 100644 index 00000000..ba7eac20 Binary files /dev/null and b/源代码/.Net/.vs/StgSharp/FileContentIndex/8fbcd803-fe1a-4a0a-8305-805ae0d96726.vsidx differ diff --git a/源代码/.Net/.vs/StgSharp/FileContentIndex/e40627f2-30e6-4c74-9b68-2b3e57f7e910.vsidx b/源代码/.Net/.vs/StgSharp/FileContentIndex/e40627f2-30e6-4c74-9b68-2b3e57f7e910.vsidx deleted file mode 100644 index 13462bb9..00000000 Binary files a/源代码/.Net/.vs/StgSharp/FileContentIndex/e40627f2-30e6-4c74-9b68-2b3e57f7e910.vsidx and /dev/null differ diff --git a/源代码/.Net/.vs/StgSharp/v17/.futdcache.v2 b/源代码/.Net/.vs/StgSharp/v17/.futdcache.v2 index c63aa52f..c814cfe2 100644 Binary files a/源代码/.Net/.vs/StgSharp/v17/.futdcache.v2 and b/源代码/.Net/.vs/StgSharp/v17/.futdcache.v2 differ diff --git a/源代码/.Net/.vs/StgSharp/v17/.suo b/源代码/.Net/.vs/StgSharp/v17/.suo index fc4314e2..dac49628 100644 Binary files a/源代码/.Net/.vs/StgSharp/v17/.suo and b/源代码/.Net/.vs/StgSharp/v17/.suo differ diff --git a/源代码/.Net/StgSharp/Math/ACos.cs b/源代码/.Net/StgSharp/Math/ACos.cs new file mode 100644 index 00000000..7a6290ef --- /dev/null +++ b/源代码/.Net/StgSharp/Math/ACos.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StgSharp +{ + public static unsafe partial class Math + { + + + public static unsafe float ACos(float x) + { + + int sign = 1; + float y; + + if (x < 0) + { + sign = -1; + y = -x; + } + else + { + y = x; + } + + if (x > 1) + { + throw new ArgumentException(); + } + + float r, s, u, v = 0.0f; + bool transform = (y >= 0.5f); + + if (transform) + { + r = 0.5f * (1.0f - y); + s = StgSharp.Math.Sqrt(r); + y = s; + } + else + { + r = y * y; + } + u = r * (0.184161606965100694821398249421F + + (-0.0565298683201845211985026327361F + + (-0.0133819288943925804214011424456F - + 0.00396137437848476485201154797087F * r) * r) * r) / + (1.10496961524520294485512696706F - + 0.836411276854206731913362287293F * r); + /**/ + + if (transform) + { + float c, s1, p, q; + uint us; + + us = *(uint*)&s; + uint uss = us & 0xffff0000; + s1 = *(float*)&uss; + + c = (r - s1 * s1) / (s + s1); + p = 2.0F * s * u - (piby2_tail - 2.0F * c); + q = hpiby2_head - 2.0F * s1; + v = hpiby2_head - (p - q); + } + else + { + v = y + y * u; + }/**/ + + v = sign * v * 90 / piby2; + + return 90-v; + } + } +} diff --git a/源代码/.Net/StgSharp/Math/ASin.cs b/源代码/.Net/StgSharp/Math/ASin.cs index 69aa505c..e322be88 100644 --- a/源代码/.Net/StgSharp/Math/ASin.cs +++ b/源代码/.Net/StgSharp/Math/ASin.cs @@ -13,7 +13,7 @@ namespace StgSharp public static unsafe partial class Math { - const float + private const float piby2_tail = 7.5497894159e-08f, /* 0x33a22168 */ hpiby2_head = 7.8539812565e-01f, /* 0x3f490fda */ piby2 = 1.5707963705e+00f; /* 0x3fc90fdb */ diff --git a/源代码/.Net/StgSharp/Math/Exp.cs b/源代码/.Net/StgSharp/Math/Exp.cs new file mode 100644 index 00000000..340b37e7 --- /dev/null +++ b/源代码/.Net/StgSharp/Math/Exp.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StgSharp +{ + public static unsafe partial class Math + { + + public const float E = 2.718281828f; + /// + /// Get the value of E ^ x; + /// + /// + /// + public static unsafe float Exp(float x) + { + if (x == 1) + { + return E; + } + if (x == 0) + { + return 1; + } + + bool sign = false; + if (x<0) + { + sign = true; + x = -x; + } + + float z = x , t; + if (x<0.5f) + { + t = 1.0f + x * ( + 1.0f + x * ( + 0.5f + x * ( + 0.1666666667f + x * ( + 0.0416666666667f + x * + 8.333333333e-3f)))); + } + else + { + uint zBit = *(uint*)&z; + uint zBitAbs = zBit & 0b_0111_1111_1111_1111_1111_1111_1111_1111; + uint uintm = (zBitAbs >> 23); + int m = (*(int*)&uintm) - 126; + + + uint nBit = (zBitAbs & 0b_0000_0000_0111_1111_1111_1111_1111_1111) + + 0b_0011_1111_0000_0000_0000_0000_0000_0000; + float n = *(float*)&nBit - 1; + + t = 2.718281828f + n * ( + 2.718281828f + n * ( + 1.359140914f + n * ( + 0.4530469714f + n * ( + 0.1132617429f + n * + 0.02265234857f)))); + + for (int i = 0; i < m; i++) + { + t = t * t; + } + } + + if (sign) + { + t = 1 / t; + } + return t; + } + } +} diff --git a/源代码/.Net/StgSharp/bin/Debug/netstandard2.1/StgSharp.dll b/源代码/.Net/StgSharp/bin/Debug/netstandard2.1/StgSharp.dll index a01c48dc..4a5b00bf 100644 Binary files a/源代码/.Net/StgSharp/bin/Debug/netstandard2.1/StgSharp.dll and b/源代码/.Net/StgSharp/bin/Debug/netstandard2.1/StgSharp.dll differ diff --git a/源代码/.Net/StgSharp/bin/Debug/netstandard2.1/StgSharp.pdb b/源代码/.Net/StgSharp/bin/Debug/netstandard2.1/StgSharp.pdb index 5f74e1ec..565c1b79 100644 Binary files a/源代码/.Net/StgSharp/bin/Debug/netstandard2.1/StgSharp.pdb and b/源代码/.Net/StgSharp/bin/Debug/netstandard2.1/StgSharp.pdb differ diff --git a/源代码/.Net/StgSharp/bin/Debug/netstandard2.1/StgSharp.xml b/源代码/.Net/StgSharp/bin/Debug/netstandard2.1/StgSharp.xml index 232b6981..6e4ab8af 100644 --- a/源代码/.Net/StgSharp/bin/Debug/netstandard2.1/StgSharp.xml +++ b/源代码/.Net/StgSharp/bin/Debug/netstandard2.1/StgSharp.xml @@ -12,6 +12,13 @@ + + + Get the value of E ^ x; + + + + Get the bits of a float number diff --git a/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache b/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache index c391c60a..21d78cf3 100644 --- a/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache +++ b/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -d6533ff9d6a5f9bebff84d6c130d7f9b4e85612a +57d2afd7a707b689bdeb3640509f8f39355cee04 diff --git a/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.dll b/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.dll index a01c48dc..4a5b00bf 100644 Binary files a/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.dll and b/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.dll differ diff --git a/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.pdb b/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.pdb index 5f74e1ec..565c1b79 100644 Binary files a/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.pdb and b/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.pdb differ diff --git a/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.xml b/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.xml index 232b6981..6e4ab8af 100644 --- a/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.xml +++ b/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/StgSharp.xml @@ -12,6 +12,13 @@ + + + Get the value of E ^ x; + + + + Get the bits of a float number diff --git a/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/ref/StgSharp.dll b/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/ref/StgSharp.dll index 0baefc79..309595cf 100644 Binary files a/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/ref/StgSharp.dll and b/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/ref/StgSharp.dll differ diff --git a/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/refint/StgSharp.dll b/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/refint/StgSharp.dll index 0baefc79..309595cf 100644 Binary files a/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/refint/StgSharp.dll and b/源代码/.Net/StgSharp/obj/Debug/netstandard2.1/refint/StgSharp.dll differ diff --git a/源代码/.Net/StgSharpDebug/Program.cs b/源代码/.Net/StgSharpDebug/Program.cs index 0f7e59ee..12deac90 100644 --- a/源代码/.Net/StgSharpDebug/Program.cs +++ b/源代码/.Net/StgSharpDebug/Program.cs @@ -12,7 +12,7 @@ internal class Program /**/ /* - float test = StgSharp.Math.Pow(4.0f,0.125f); + float test = StgSharp.Math.ACos(0.5f); Console.WriteLine(test); /**/ @@ -26,7 +26,7 @@ internal class Program stopwatch.Start(); // 开始监视代码运行时间 for (float i = 2; i < time; i++) { - a = StgSharp.Math.Pow(i, i); + a = StgSharp.Math.ACos(i/500000-1); } stopwatch.Stop(); // 停止监视 TimeSpan timespan = stopwatch.Elapsed; // 获取当前实例测量得出的总时间 @@ -40,7 +40,7 @@ internal class Program stopwatch1.Start(); for (float i = 2; i < time2; i++) { - b = System.MathF.Pow(i, i); + b = System.MathF.Acos(i / 500000 - 1); } stopwatch1.Stop(); timespan = stopwatch1.Elapsed; @@ -51,14 +51,14 @@ internal class Program /**/ - + /* //精度测试 double accuracy = 0; - for (float i = -10f; i < 2000f; i += 0.01f) + for (float i = -10f; i < 200f; i += 0.01f) { - double r1 = StgSharp.Math.Pow(2,i); - double r2 = System.Math.Pow(2,i); + double r1 = StgSharp.Math.ACos(i/100); + double r2 = 180*System.Math.Acos(i/100)/3.1415926; double ac = ( System.Math.Max(r1,r2)- System.Math.Min(r1, r2) ) / r2; if (ac>accuracy) { diff --git a/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharp.dll b/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharp.dll index a01c48dc..4a5b00bf 100644 Binary files a/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharp.dll and b/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharp.dll differ diff --git a/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharp.pdb b/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharp.pdb index 5f74e1ec..565c1b79 100644 Binary files a/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharp.pdb and b/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharp.pdb differ diff --git a/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharp.xml b/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharp.xml index 232b6981..6e4ab8af 100644 --- a/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharp.xml +++ b/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharp.xml @@ -12,6 +12,13 @@ + + + Get the value of E ^ x; + + + + Get the bits of a float number diff --git a/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharpDebug.dll b/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharpDebug.dll index fa498975..c21cdef2 100644 Binary files a/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharpDebug.dll and b/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharpDebug.dll differ diff --git a/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharpDebug.pdb b/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharpDebug.pdb index ffbd07b9..074d7ba1 100644 Binary files a/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharpDebug.pdb and b/源代码/.Net/StgSharpDebug/bin/Debug/net6.0/StgSharpDebug.pdb differ diff --git a/源代码/.Net/StgSharpDebug/obj/Debug/net6.0/StgSharpDebug.csproj.AssemblyReference.cache b/源代码/.Net/StgSharpDebug/obj/Debug/net6.0/StgSharpDebug.csproj.AssemblyReference.cache index 6b550cbe..399695e3 100644 Binary files a/源代码/.Net/StgSharpDebug/obj/Debug/net6.0/StgSharpDebug.csproj.AssemblyReference.cache and b/源代码/.Net/StgSharpDebug/obj/Debug/net6.0/StgSharpDebug.csproj.AssemblyReference.cache differ diff --git a/源代码/.Net/StgSharpDebug/obj/Debug/net6.0/StgSharpDebug.dll b/源代码/.Net/StgSharpDebug/obj/Debug/net6.0/StgSharpDebug.dll index fa498975..c21cdef2 100644 Binary files a/源代码/.Net/StgSharpDebug/obj/Debug/net6.0/StgSharpDebug.dll and b/源代码/.Net/StgSharpDebug/obj/Debug/net6.0/StgSharpDebug.dll differ diff --git a/源代码/.Net/StgSharpDebug/obj/Debug/net6.0/StgSharpDebug.pdb b/源代码/.Net/StgSharpDebug/obj/Debug/net6.0/StgSharpDebug.pdb index ffbd07b9..074d7ba1 100644 Binary files a/源代码/.Net/StgSharpDebug/obj/Debug/net6.0/StgSharpDebug.pdb and b/源代码/.Net/StgSharpDebug/obj/Debug/net6.0/StgSharpDebug.pdb differ