From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function SameValue(const A, B: Extended; Epsilon: Extended): Boolean;
function SameValue(const A, B: Double; Epsilon: Double): Boolean;
function SameValue(const A, B: Single; Epsilon: Single): Boolean;


extern DELPHI_PACKAGE bool __fastcall SameValue(const System::Extended A, const System::Extended B, System::Extended Epsilon = 0.000000E+00)/* overload */;


Type Visibility Source Unit Parent
function public
System.Math System.Math


Indicates whether two floating-point values are (approximately) equal.

Call SameValue to determine when two floating-point values are equal, or approximately equal.

<A> and <B> are the values to compare.

<Epsilon> is the maximum amount by which <A> and <B> can differ and still be considered the same value.

If <Epsilon> = 0, then some reasonable default value is used implicitly. For example, the Double version of SameValue uses the default value:

Epsilon = Max(Min(Abs(A), Abs(B)) * 1E-12, 1E-12)

See Also