Synced
MathHelper.AlmostEquals
Section titled “MathHelper.AlmostEquals”
- Determines whether two floating-point numbers are approximately equal, using a relative tolerance based on the magnitude of the numbers. This is useful for comparing floats where rounding errors may occur.
Required contracts
Section titled “Required contracts”API: scripting
Project: Inno.Core.Mathematics
Scope: Runtime
Declaration
Section titled “Declaration”public static bool InnoEngine.Mathematics.MathHelper.AlmostEquals(float a, float b, float relTolerance = 1E-06)Parameters
Section titled “Parameters”Parameter a: The first float value to compare.
Parameter b: The second float value to compare.
Parameter relTolerance: The relative tolerance allowed between a and b. Default is 1e-6. The comparison checks if the difference is within relTolerance * max(|a|, |b|).
Returns
Section titled “Returns”true if the absolute difference between a and b is less than or equal to the relative tolerance multiplied by the larger magnitude of the two values; otherwise, false.