nfloat.CompareTo Method

Definition

Overloads

CompareTo(nfloat)

Compares this instance to a specified nfloat floating-point number and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified nfloat floating-point number.

CompareTo(Object)

Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.

CompareTo(nfloat)

Compares this instance to a specified nfloat floating-point number and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified nfloat floating-point number.

public int CompareTo (nfloat value);
abstract member CompareTo : nfloat -> int
override this.CompareTo : nfloat -> int

Parameters

value
nfloat

Returns

Implements

Applies to

CompareTo(Object)

Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.

public int CompareTo (object value);
abstract member CompareTo : obj -> int
override this.CompareTo : obj -> int

Parameters

value
Object

An object to compare, or null.

Returns

A signed number indicating the relative values of this instance and value.

Value 

Description 

A negative integer 

This instance is less than value.

-or- 

This instance is not a number (NaN) and value is a number. 

Zero 

This instance is equal to value.

-or- 

This instance and value are both nfloat.NaN, PositiveInfinity, or NegativeInfinity

A positive integer 

This instance is greater than value.

-or- 

This instance is a number and value is not a number (NaN).

-or- 

value is null. 

Implements

Remarks

The value parameter must be null or an instance of nfloat; otherwise, an exception is thrown. Any instance of nfloat, regardless of its value, is considered greater than null.

Values must be identical to be considered equal. Particularly when floating-point values depend on multiple mathematical operations, it is common for them to lose precision and for their values to be nearly identical except for their least significant digits. Because of this, the return value of the CompareTo(Object) method at times may seem surprising.

Applies to