System.Math.SameValue

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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;

C++

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

Properties

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

Description

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