Double.Compare

Syntax

Compare(Value1: Double; Value2: Double): Integer;

Parameters

Value1. The first compared real value.

Value2. The second compared real value.

Description

The Compare method compares two real numbers without taking into account precision.

Comments

The method returns "-1" if Value1>Value2, "0" if Value1=Value2 and "-1" if Value1<Value2.

Example

Sub Main;
Var
    x1, x2: Double;
    i: Integer;
Begin
    x1 := Math.Rand;
    x2 := Math.Rand;
    i := Double.Compare(x1, x2);
End Sub Main;

After executing the example the "i" variable will contain the attribute of comparison two random real numbers.

See also:

Double