Float.Compare(Single, Single) Method

Definition

Compares the two specified float values.

[Android.Runtime.Register("compare", "(FF)I", "")]
public static int Compare (float f1, float f2);
[<Android.Runtime.Register("compare", "(FF)I", "")>]
static member Compare : single * single -> int

Parameters

f1
Single

the first float to compare.

f2
Single

the second float to compare.

Returns

the value 0 if f1 is numerically equal to f2; a value less than 0 if f1 is numerically less than f2; and a value greater than 0 if f1 is numerically greater than f2.

Attributes

Remarks

Compares the two specified float values. The sign of the integer value returned is the same as that of the integer that would be returned by the call:

new Float(f1).compareTo(new Float(f2))

Added in 1.4.

Java documentation for java.lang.Float.compare(float, float).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to