// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using UnityEngine; namespace Microsoft.MixedReality.Toolkit { /// /// Extension methods for the .Net Float struct /// public static class FloatExtensions { /// /// 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 float number, float other, float tolerance) { return Mathf.Abs(number - other) <= tolerance; } } }