SetFloatDelta Function | ![X#](../icons/logo100.jpg) |
Return and optionally change the setting that determines the point at which 2 floating point numbers would be considered equal even though they are different.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION SetFloatDelta() AS REAL8
public static double SetFloatDelta()
Request Example
View SourceReturn Value
Type:
Double
If
nNewSetting is not specified, SetFloatDelta() returns the current setting.
If
nNewSetting is specified, the previous setting is returned.
Remarks
SetFloatDelta() determines the maximum amount by which 2 floating point numbers could be different and yet still be considered equal. Two numbers might be considerably different, but the difference will be ignored if the setting for SetFloatDelta() is larger than the difference between the 2 numbers.
Examples
This example uses SetFloatDelta() to change the result of numeric comparisons:
1? 1.231 = 1.23
2? 1.33 = 1.23
3SetFloatDelta(0.01)
4? 1.231 = 1.23
5? 1.33 = 1.23
6? 1.4 < 1.40123456
7? 1.4 < 1.42
See Also