Export (0) Print
Expand All

Rational Structure

Solver Foundation 3.0

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Represents a rational number.

Namespace:  Microsoft.SolverFoundation.Common
Assembly:  Microsoft.Solver.Foundation (in Microsoft.Solver.Foundation.dll)

'Declaration
<CLSCompliantAttribute(True)> _
Public Structure Rational _
	Implements IComparable, IComparable(Of Rational),  _
	IEquatable(Of Rational), IComparable(Of BigInteger), IEquatable(Of BigInteger),  _
	IComparable(Of Integer), IEquatable(Of Integer), IComparable(Of UInteger),  _
	IEquatable(Of UInteger), IComparable(Of Long), IEquatable(Of Long),  _
	IComparable(Of ULong), IEquatable(Of ULong), IComparable(Of Double),  _
	IEquatable(Of Double)

The Rational type exposes the following members.

  NameDescription
Public propertyAbsoluteValueGets the absolute value of a number.
Public propertyBitCountGets an integer that represents the number of bits.
Public propertyDenominatorGets the denominator of a number.
Public propertyHasSignReturns a value that indicates whether a Rational object is signed.
Public propertyIsFiniteReturns a value that indicates whether a Rational object is finite.
Public propertyIsIndeterminateReturns a value that indicates whether a Rational object is indeterminate.
Public propertyIsInfiniteReturns a value that indicates whether a Rational object is infinite.
Public propertyIsNegativeInfinityReturns a value that indicates whether a Rational object is negative infinity.
Public propertyIsOneReturns a value that indicates whether a Rational object is equal to one.
Public propertyIsPositiveInfinityReturns a value that indicates whether a Rational object is positive infinity.
Public propertyIsSignedInfinityReturns a value that indicates whether a Rational object is signed infinity.
Public propertyIsUnsignedInfinityReturns a value that indicates whether a Rational object is unsigned infinity.
Public propertyIsZeroReturns a value that indicates whether a Rational object is equal to zero.
Public propertyNumeratorGets the numerator of a number.
Public propertySignGets a value that indicates the sign of a number.
Top

  NameDescription
Public methodStatic memberAddMulPerforms and optimizes the operation ratAdd + ratMul1 * ratMul2.
Public methodAppendDecimalStringAppends characters to a string.
Public methodCompareTo(Double)Compares a rational number to a double.
Public methodCompareTo(Int32)Compares a rational number to an integer.
Public methodCompareTo(Int64)Compares a rational number to a long integer.
Public methodCompareTo(Object)Compares a rational number to another number (Int32, UInt32, Double, Int64, UInt64, Rational, or BigInteger).
Public methodCompareTo(UInt32)Compares a rational number to an unsigned integer.
Public methodCompareTo(UInt64)Compares a rational number to an unsigned long integer.
Public methodCompareTo(BigInteger)Compares a rational number to a big integer.
Public methodCompareTo(Rational)Compares a rational number to another rational number.
Public methodEquals(Double)Returns a value that indicates whether a rational number is equal to a double.
Public methodEquals(Int32)Returns a value that indicates whether a rational number is equal to an integer.
Public methodEquals(Int64)Returns a value that indicates whether a rational number is equal to a long integer.
Public methodEquals(Object)Returns a value that indicates whether a rational number is equal to another number (Int32, UInt32, Double, Int64, UInt64, Rational, or BigInteger). (Overrides ValueType.Equals(Object).)
Public methodEquals(UInt32)Returns a value that indicates whether a rational number is equal to an unsigned integer.
Public methodEquals(UInt64)Returns a value that indicates whether a rational number is equal to an unsigned long integer.
Public methodEquals(BigInteger)Returns a value that indicates whether a rational number is equal to a big integer.
Public methodEquals(Rational)Returns a value that indicates whether a rational number is equal to another rational number.
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic memberGetCreates a rational number by dividing one big integer by another.
Public methodGetCeilingReturns the ceiling of a rational number.
Public methodGetCeilingResidualReturns the ceiling residual of a rational number.
Public methodGetFloorReturns the floor of a rational number.
Public methodGetFloorResidualReturns the floor residual of a rational number.
Public methodGetFractionalPartReturns the fractional part of a rational number.
Public methodGetHashCodeReturns the hash code of a rational number. (Overrides ValueType.GetHashCode.)
Public methodGetIntegerPartReturns the integer part of a rational number.
Public methodGetSignedDoubleConverts a rational number to a signed double.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInvertInverts the sign of a rational number.
Public methodIsIntegerReturns a value that indicates whether a number is an integer.
Public methodIsInteger(BigInteger)Returns a value that indicates whether a number is an integer, and clones the integer.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic memberNegateNegates the sign of a rational number.
Public methodStatic memberPowerReturns a value that indicates whether a rational number was raised to the power of another rational number successfully.
Public methodToDoubleConverts a rational number to the nearest double.
Public methodToStringConverts a rational number to its equivalent string representation. (Overrides ValueType.ToString.)
Top

  NameDescription
Public operatorStatic memberAdditionAdds two rational numbers.
Public operatorStatic memberDivisionDivides one rational number by another.
Public operatorStatic memberEquality(Double, Rational)Returns a value that indicates whether a double is equal to a rational number.
Public operatorStatic memberEquality(Int32, Rational)Returns a value that indicates whether an integer is equal to a rational number.
Public operatorStatic memberEquality(Int64, Rational)Returns a value that indicates whether a long integer is equal to a rational number.
Public operatorStatic memberEquality(UInt32, Rational)Returns a value that indicates whether an unsigned integer is equal to a rational number.
Public operatorStatic memberEquality(UInt64, Rational)Returns a value that indicates whether an unsigned long is equal to a rational number.
Public operatorStatic memberEquality(BigInteger, Rational)Returns a value that indicates whether a big integer is equal to a rational number.
Public operatorStatic memberEquality(Rational, BigInteger)Returns a value that indicates whether a rational number is equal to a big integer.
Public operatorStatic memberEquality(Rational, Rational)Returns a value that indicates whether a rational number is equal to another rational number.
Public operatorStatic memberEquality(Rational, Double)Returns a value that indicates whether a rational number is equal to a double.
Public operatorStatic memberEquality(Rational, Int32)Returns a value that indicates whether a rational number is equal to an integer.
Public operatorStatic memberEquality(Rational, Int64)Returns a value that indicates whether a rational number is equal to a long integer.
Public operatorStatic memberEquality(Rational, UInt32)Returns a value that indicates whether a rational number is equal to an unsigned integer.
Public operatorStatic memberEquality(Rational, UInt64)Returns a value that indicates whether a rational number is equal to an unsigned long integer.
Public operatorStatic memberNarrowing(Rational to UInt32)Converts a rational number to an unsigned integer.
Public operatorStatic memberNarrowing(Rational to Int32)Converts a rational number to an integer.
Public operatorStatic memberNarrowing(Rational to Double)Converts a rational number to a double.
Public operatorStatic memberNarrowing(Rational to BigInteger)Converts a rational number to a big integer.
Public operatorStatic memberNarrowing(Rational to Int64)Converts a rational number to a long integer.
Public operatorStatic memberNarrowing(Rational to UInt64)Converts a rational number to an unsigned long integer.
Public operatorStatic memberGreaterThan(Double, Rational)Returns a value that indicates whether a double is greater than a rational number.
Public operatorStatic memberGreaterThan(Int32, Rational)Returns a value that indicates whether an integer is greater than a rational number.
Public operatorStatic memberGreaterThan(Int64, Rational)Returns a value that indicates whether a long integer is greater than a rational number.
Public operatorStatic memberGreaterThan(UInt32, Rational)Returns a value that indicates whether an unsigned integer is greater than rational number.
Public operatorStatic memberGreaterThan(UInt64, Rational)Returns a value that indicates whether an unsigned long integer is greater than rational number.
Public operatorStatic memberGreaterThan(BigInteger, Rational)Returns a value that indicates whether a big integer is greater than a rational number.
Public operatorStatic memberGreaterThan(Rational, BigInteger)Returns a value that indicates whether a rational number is greater than a big integer.
Public operatorStatic memberGreaterThan(Rational, Rational)Returns a value that indicates whether one rational number is greater than another rational number.
Public operatorStatic memberGreaterThan(Rational, Double)Returns a value that indicates whether a rational number is greater than a double.
Public operatorStatic memberGreaterThan(Rational, Int32)Returns a value that indicates whether a rational number is greater than an integer.
Public operatorStatic memberGreaterThan(Rational, Int64)Returns a value that indicates whether a rational number is greater than a long integer.
Public operatorStatic memberGreaterThan(Rational, UInt32)Returns a value that indicates whether a rational number is greater than an unsigned integer.
Public operatorStatic memberGreaterThan(Rational, UInt64)Returns a value that indicates whether a rational number is greater than an unsigned long integer.
Public operatorStatic memberGreaterThanOrEqual(Double, Rational)Returns a value that indicates whether a double is greater than or equal to a rational number.
Public operatorStatic memberGreaterThanOrEqual(Int32, Rational)Returns a value that indicates whether an integer is greater than or equal to a rational number.
Public operatorStatic memberGreaterThanOrEqual(Int64, Rational)Returns a value that indicates whether a long integer is greater than or equal to a rational number.
Public operatorStatic memberGreaterThanOrEqual(UInt32, Rational)Returns a value that indicates whether an unsigned integer is greater than or equal to a rational number.
Public operatorStatic memberGreaterThanOrEqual(UInt64, Rational)Returns a value that indicates whether an unsigned long integer is greater than or equal to a rational number.
Public operatorStatic memberGreaterThanOrEqual(BigInteger, Rational)Returns a value that indicates whether a big integer is greater than or equal to a rational number.
Public operatorStatic memberGreaterThanOrEqual(Rational, BigInteger)Returns a value that indicates whether a rational number is greater than or equal to a big integer.
Public operatorStatic memberGreaterThanOrEqual(Rational, Rational)Returns a value that indicates whether a rational number is greater than or equal to another rational number.
Public operatorStatic memberGreaterThanOrEqual(Rational, Double)Returns a value that indicates whether a rational number is greater than or equal to a double.
Public operatorStatic memberGreaterThanOrEqual(Rational, Int32)Returns a value that indicates whether a rational number is greater than or equal to an integer.
Public operatorStatic memberGreaterThanOrEqual(Rational, Int64)Returns a value that indicates whether a rational number is greater than or equal to a long integer.
Public operatorStatic memberGreaterThanOrEqual(Rational, UInt32)Returns a value that indicates whether a rational number is greater than or equal to an unsigned integer.
Public operatorStatic memberGreaterThanOrEqual(Rational, UInt64)Returns a value that indicates whether a rational number is greater than or equal to an unsigned long integer.
Public operatorStatic memberWidening(Double to Rational)Converts a double to a rational number.
Public operatorStatic memberWidening(Int32 to Rational)Converts an integer to a rational number.
Public operatorStatic memberWidening(Int64 to Rational)Converts a long integer to a rational number.
Public operatorStatic memberWidening(UInt32 to Rational)Converts an unsigned integer to a rational number.
Public operatorStatic memberWidening(UInt64 to Rational)Converts an unsigned long integer to a rational number.
Public operatorStatic memberWidening(BigInteger to Rational)Converts a big integer to a rational number.
Public operatorStatic memberInequality(Double, Rational)Returns a value that indicates whether a double is not equal to a rational number.
Public operatorStatic memberInequality(Int32, Rational)Returns a value that indicates whether an integer is not equal to a rational number.
Public operatorStatic memberInequality(Int64, Rational)Returns a value that indicates whether a long integer is not equal to a rational number.
Public operatorStatic memberInequality(UInt32, Rational)Returns a value that indicates whether an unsigned integer is not equal to a rational number.
Public operatorStatic memberInequality(UInt64, Rational)Returns a value that indicates whether an unsigned long integer is not equal to a rational number.
Public operatorStatic memberInequality(BigInteger, Rational)Returns a value that indicates whether a big integer is not equal to a rational number.
Public operatorStatic memberInequality(Rational, BigInteger)Returns a value that indicates whether a rational number is not equal to a big integer.
Public operatorStatic memberInequality(Rational, Rational)Returns a value that indicates whether a rational number is not equal to a rational number.
Public operatorStatic memberInequality(Rational, Double)Returns a value that indicates whether a rational number is not equal to a double.
Public operatorStatic memberInequality(Rational, Int32)Returns a value that indicates whether a rational number is not equal to an integer.
Public operatorStatic memberInequality(Rational, Int64)Returns a value that indicates whether a rational number is not equal to a long.
Public operatorStatic memberInequality(Rational, UInt32)Returns a value that indicates whether a rational number is not equal to an unsigned integer.
Public operatorStatic memberInequality(Rational, UInt64)Returns a value that indicates whether a rational number is not equal to an unsigned long integer.
Public operatorStatic memberLessThan(Double, Rational)Returns a value that indicates whether a double is less than a rational number.
Public operatorStatic memberLessThan(Int32, Rational)Returns a value that indicates whether an integer is less than a rational number.
Public operatorStatic memberLessThan(Int64, Rational)Returns a value that indicates whether a long integer is less than a rational number.
Public operatorStatic memberLessThan(UInt32, Rational)Returns a value that indicates whether an unsigned integer is less than a rational number.
Public operatorStatic memberLessThan(UInt64, Rational)Returns a value that indicates whether an unsigned long integer is less than a rational number.
Public operatorStatic memberLessThan(BigInteger, Rational)Returns a value that indicates whether a big integer is less than a rational number.
Public operatorStatic memberLessThan(Rational, BigInteger)Returns a value that indicates whether a rational number is less than a big integer.
Public operatorStatic memberLessThan(Rational, Rational)Returns a value that indicates whether a rational number is less than another rational number.
Public operatorStatic memberLessThan(Rational, Double)Returns a value that indicates whether a rational number is less than a double.
Public operatorStatic memberLessThan(Rational, Int32)Returns a value that indicates whether a rational number is less than an integer.
Public operatorStatic memberLessThan(Rational, Int64)Returns a value that indicates whether a rational number is less than a long integer.
Public operatorStatic memberLessThan(Rational, UInt32)Returns a value that indicates whether a rational number is less than an unsigned integer.
Public operatorStatic memberLessThan(Rational, UInt64)Returns a value that indicates whether a rational number is less than an unsigned long integer.
Public operatorStatic memberLessThanOrEqual(Double, Rational)Returns a value that indicates whether a double is less than or equal to a rational number.
Public operatorStatic memberLessThanOrEqual(Int32, Rational)Returns a value that indicates whether an integer is less than or equal to a rational number.
Public operatorStatic memberLessThanOrEqual(Int64, Rational)Returns a value that indicates whether a long integer is less than or equal to a rational number.
Public operatorStatic memberLessThanOrEqual(UInt32, Rational)Returns a value that indicates whether an unsigned integer is less than or equal to a rational number.
Public operatorStatic memberLessThanOrEqual(UInt64, Rational)Returns a value that indicates whether an unsigned long integer is less than or equal to a rational number.
Public operatorStatic memberLessThanOrEqual(BigInteger, Rational)Returns a value that indicates whether a big integer is less than or equal to a rational number.
Public operatorStatic memberLessThanOrEqual(Rational, BigInteger)Returns a value that indicates whether a rational number is less than or equal to a big integer.
Public operatorStatic memberLessThanOrEqual(Rational, Rational)Returns a value that indicates whether a rational number is less than or equal to another rational number.
Public operatorStatic memberLessThanOrEqual(Rational, Double)Returns a value that indicates whether a rational number is less than or equal to a double.
Public operatorStatic memberLessThanOrEqual(Rational, Int32)Returns a value that indicates whether a rational number is less than or equal to an integer.
Public operatorStatic memberLessThanOrEqual(Rational, Int64)Returns a value that indicates whether a rational number is less than or equal to a long integer.
Public operatorStatic memberLessThanOrEqual(Rational, UInt32)Returns a value that indicates whether a rational number is less than or equal to an unsigned integer.
Public operatorStatic memberLessThanOrEqual(Rational, UInt64)Returns a value that indicates whether a rational number is less than or equal to an unsigned long integer.
Public operatorStatic memberMultiplyReturns the product of two rational numbers.
Public operatorStatic memberSubtractionSubtracts a rational number from another rational number.
Public operatorStatic memberUnaryNegationNegates a specified rational number.
Top

  NameDescription
Public fieldStatic memberIndeterminateRepresents a Rational object that is not a number.
Public fieldStatic memberNegativeInfinityRepresents a Rational object that is equal to negative infinity (-1, 0).
Public fieldStatic memberOneRepresents a Rational object that is equal to 1.
Public fieldStatic memberPositiveInfinityRepresents a Rational object that is equal to positive infinity (+1, 0).
Public fieldStatic memberUnsignedInfinityRepresents a Rational object that is equal to unsigned infinity (+2, 0).
Public fieldStatic memberZeroRepresents a Rational object that is equal to 0.
Top

The following table lists how special cases of rational numbers are represented.

Rational number

Representation

Non-zero finite rational values

(numerator, denominator) with denominator > 0

Zero

(0, 0)

Negative infinity

(-1, 0)

Positive infinity

(+1, 0)

Unsigned infinity

(+2, 0)

Indeterminate (NaN)

(+3, 0)

Dividing a nonzero value by zero results in unsigned infinity because 0 is unsigned. Dividing a finite value by any infinite value results in 0.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft