// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; namespace Microsoft.MixedReality.Toolkit { /// /// Extension methods for the .Net Double struct /// public static class DoubleExtensions { /// /// Checks if two numbers are approximately equal. Similar to Mathf.Approximately(float, float), but the tolerance /// can be specified. /// /// One of the numbers to compare. /// The other number to compare. /// The amount of tolerance to allow while still considering the numbers approximately equal. /// True if the difference between the numbers is less than or equal to the tolerance, false otherwise. public static bool Approximately(this double number, double other, double tolerance) { return Math.Abs(number - other) <= tolerance; } } }