Fix formating in MathHelper.cs

This commit is contained in:
VperuS 2018-01-02 15:06:09 +02:00 committed by GitHub
parent 6b4077fbc6
commit f22a18587c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -305,7 +305,8 @@ namespace OpenTK
return Math.Max(Math.Min(n, max), min); return Math.Max(Math.Min(n, max), min);
} }
private static unsafe int FloatToInt32Bits(float f) { private static unsafe int FloatToInt32Bits(float f)
{
return *((int*)&f); return *((int*)&f);
} }
@ -319,7 +320,8 @@ namespace OpenTK
/// <param name="b">>the second value to compare</param> /// <param name="b">>the second value to compare</param>
/// <param name="maxDeltaBits">the number of floating point bits to check</param> /// <param name="maxDeltaBits">the number of floating point bits to check</param>
/// <returns></returns> /// <returns></returns>
public static bool ApproximatelyEqual(float a, float b, int maxDeltaBits) { public static bool ApproximatelyEqual(float a, float b, int maxDeltaBits)
{
// we use longs here, otherwise we run into a two's complement problem, causing this to fail with -2 and 2.0 // we use longs here, otherwise we run into a two's complement problem, causing this to fail with -2 and 2.0
long aInt = FloatToInt32Bits(a); long aInt = FloatToInt32Bits(a);
if (aInt < 0) if (aInt < 0)
@ -449,7 +451,5 @@ namespace OpenTK
double diff = Math.Abs(a - b); double diff = Math.Abs(a - b);
return diff <= tolerance; return diff <= tolerance;
} }
} }
} }