FloatExtensionsTolerantEquals Method

Gets whether two float values are equal considering the specified tolerance.


Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.0.0
public static bool TolerantEquals(
	this float value,
	float other,
	float tolerance = 1E-06f


value  Single
The value to be compared to another one.
other  Single
The other value compared to the self value.
tolerance  Single  (Optional)
The tolerance to be used. For the best performance its value is not checked but it should be some low positive value to get a reasonable result. This parameter is optional.
Default value: 0.000001 (10-6).

Return Value

, if the values are equal considering the specified tolerance; otherwise, .

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Single. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also