New IO structure, unexpexted error in C code
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
@@ -69,7 +67,7 @@ namespace StgSharp.Math
|
||||
v = y + y * u;
|
||||
}/**/
|
||||
|
||||
v = sign * v ;
|
||||
v = sign * v;
|
||||
|
||||
return piby2 - v;
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace StgSharp.Math
|
||||
@@ -26,13 +24,13 @@ namespace StgSharp.Math
|
||||
/// <param name="x">The sine value of the angle</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public static float ASin(float x )
|
||||
public static float ASin(float x)
|
||||
{
|
||||
|
||||
int sign = 1;
|
||||
float y ;
|
||||
|
||||
if (x<0)
|
||||
int sign = 1;
|
||||
float y;
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
sign = -1;
|
||||
y = -x;
|
||||
@@ -42,14 +40,14 @@ namespace StgSharp.Math
|
||||
y = x;
|
||||
}
|
||||
|
||||
if ( x>1)
|
||||
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);
|
||||
@@ -60,7 +58,7 @@ namespace StgSharp.Math
|
||||
{
|
||||
r = y * y;
|
||||
}
|
||||
u= r * (0.184161606965100694821398249421F +
|
||||
u = r * (0.184161606965100694821398249421F +
|
||||
(-0.0565298683201845211985026327361F +
|
||||
(-0.0133819288943925804214011424456F -
|
||||
0.00396137437848476485201154797087F * r) * r) * r) /
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Calc
|
||||
{
|
||||
@@ -30,7 +26,7 @@ namespace StgSharp.Math
|
||||
angle = 0.7853981634f;
|
||||
}
|
||||
|
||||
float v = 0.7853981634f * x + x * (1 - x) * (0.2447f+0.0663f * x);
|
||||
float v = 0.7853981634f * x + x * (1 - x) * (0.2447f + 0.0663f * x);
|
||||
v += angle;
|
||||
v *= sign;
|
||||
|
||||
@@ -46,10 +42,10 @@ namespace StgSharp.Math
|
||||
|
||||
float z = y / x;
|
||||
|
||||
float sign = 1, angle = 0,angle2 = 0;
|
||||
if (x<0)
|
||||
float sign = 1, angle = 0, angle2 = 0;
|
||||
if (x < 0)
|
||||
{
|
||||
angle = -3.1415926535f ;
|
||||
angle = -3.1415926535f;
|
||||
}
|
||||
if (z < 0)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Numerics;
|
||||
using System.Globalization;
|
||||
|
||||
namespace StgSharp.Math
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static partial class Calc
|
||||
{
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public unsafe delegate float ScalarCalcHandler(float* x);
|
||||
|
||||
public static unsafe partial class Calc
|
||||
public static unsafe partial class Calc
|
||||
{
|
||||
[DllImport("Kernel32.dll", EntryPoint = "VirtualAlloc")]
|
||||
private static extern IntPtr VirtualAlloc(IntPtr address, int size, uint allocType, uint protect);
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Calc
|
||||
{
|
||||
@@ -25,14 +21,14 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
bool sign = false;
|
||||
if (x<0)
|
||||
if (x < 0)
|
||||
{
|
||||
sign = true;
|
||||
x = -x;
|
||||
}
|
||||
|
||||
float z = x , t;
|
||||
if (x<0.5f)
|
||||
float z = x, t;
|
||||
if (x < 0.5f)
|
||||
{
|
||||
t = 1.0f + x * (
|
||||
1.0f + x * (
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public class Function
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using static System.Net.WebRequestMethods;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static partial class Calc
|
||||
{
|
||||
|
||||
static private readonly float[] logArray =
|
||||
private static readonly float[] logArray =
|
||||
{
|
||||
0f, 0.00995033085316809f, 0.0198026272961797f, 0.0295588022415444f, 0.0392207131532813f, 0.048790164169432f, 0.0582689081239758f, 0.0676586484738149f, 0.0769610411361284f, 0.0861776962410524f,
|
||||
0.0953101798043249f, 0.104360015324243f, 0.113328685307003f, 0.122217632724249f, 0.131028262406404f, 0.139761942375159f, 0.148420005118273f, 0.157003748809665f, 0.165514438477573f, 0.173953307123438f,
|
||||
@@ -30,9 +26,9 @@ namespace StgSharp.Math
|
||||
/// <returns>
|
||||
/// Returns the value of ln(x).
|
||||
/// </returns>
|
||||
public unsafe static float Log(float x)
|
||||
public static unsafe float Log(float x)
|
||||
{
|
||||
if (x<0)
|
||||
if (x < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
@@ -45,24 +41,24 @@ namespace StgSharp.Math
|
||||
input >>= 9;
|
||||
input += 0b_0011_1111_1000_0000_0000_0000_0000_0000;
|
||||
float result = *(float*)&input;
|
||||
int order = (int)(result * 100)-100;
|
||||
int order = (int)(result * 100) - 100;
|
||||
|
||||
float cache = (result) / (1f + 0.01f * order) -1 ;
|
||||
float cache = (result) / (1f + 0.01f * order) - 1;
|
||||
result = cache * -0.25f + 0.3333333333333f;
|
||||
result = result * cache - 0.5f;
|
||||
result = result * cache + 1.0f;
|
||||
result *= cache;
|
||||
|
||||
return
|
||||
f*0.6931471806f +
|
||||
result +
|
||||
return
|
||||
f * 0.6931471806f +
|
||||
result +
|
||||
logArray[order];
|
||||
}
|
||||
|
||||
|
||||
public static float Log(float x, float y)
|
||||
{
|
||||
return Log(x)/Log(y);
|
||||
return Log(x) / Log(y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Calc
|
||||
{
|
||||
/// <summary>
|
||||
@@ -31,7 +27,7 @@ namespace StgSharp.Math
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (x==1&&y==0)
|
||||
if (x == 1 && y == 0)
|
||||
{
|
||||
return 1.0f / 0;
|
||||
}
|
||||
@@ -44,7 +40,7 @@ namespace StgSharp.Math
|
||||
z = -z;
|
||||
}
|
||||
|
||||
if (z<0.5f)
|
||||
if (z < 0.5f)
|
||||
{
|
||||
t = 1.0f + z * (
|
||||
1.0f + z * (
|
||||
@@ -77,7 +73,7 @@ namespace StgSharp.Math
|
||||
t = t * t;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
if (sign)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static partial class Calc
|
||||
{
|
||||
@@ -45,7 +41,7 @@ namespace StgSharp.Math
|
||||
float refer2 = refer * refer;
|
||||
|
||||
|
||||
return sinData[a]*(1 - 0.0123370055f * refer2 + 2.536695709e-5f * refer2 * refer2 )
|
||||
return sinData[a] * (1 - 0.0123370055f * refer2 + 2.536695709e-5f * refer2 * refer2)
|
||||
+ cosData[a] * (0.1570796327f * refer - 6.459640975e-4f * refer * refer2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static partial class Calc
|
||||
{
|
||||
@@ -21,8 +17,8 @@ namespace StgSharp.Math
|
||||
float sin = (0.1570796327f * refer - 6.459640975e-4f * refer * refer2);
|
||||
float cos = (1 - 0.0123370055f * refer2 + 2.536695709e-5f * refer2 * refer2);
|
||||
|
||||
return ( sinData[a] * cos + cosData[a] * sin )
|
||||
/ ( cosData[a] * cos - sinData[a] * sin );
|
||||
return (sinData[a] * cos + cosData[a] * sin)
|
||||
/ (cosData[a] * cos - sinData[a] * sin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user