close #397
This commit is contained in:
1 parent
2f08667db8
commit
0cdd558e5d
12 files changed
+210
-30
No files matched your search
@@ -4,6 +4,8 @@ namespace HandyControl.Expression.Drawing
|
||||
{
|
||||
internal static class MathHelper
|
||||
{
|
||||
internal const double DBL_EPSILON = 2.2204460492503131e-016;
|
||||
|
||||
public static bool AreClose(double value1, double value2) =>
|
||||
// ReSharper disable once CompareOfFloatsByEqualityOperator
|
||||
value1 == value2 || IsVerySmall(value1 - value2);
|
||||
@@ -12,6 +14,8 @@ namespace HandyControl.Expression.Drawing
|
||||
|
||||
public static bool IsVerySmall(double value) => Math.Abs(value) < 1E-06;
|
||||
|
||||
public static bool IsZero(double value) => Math.Abs(value) < 10.0 * DBL_EPSILON;
|
||||
|
||||
public static bool IsFiniteDouble(double x) => !double.IsInfinity(x) && !double.IsNaN(x);
|
||||
|
||||
public static double DoubleFromMantissaAndExponent(double x, int exp) => x * Math.Pow(2.0, exp);
|
||||
|
||||
Reference in new issue
Block a user