Click or drag to resize
Accord.NET (logo)

Rational Structure

Rational number.

Namespace:  Accord.Math
Assembly:  Accord (in Accord.dll) Version: 3.8.0
Syntax
[SerializableAttribute]
[TypeConverterAttribute(typeof(RationalConverter))]
public struct Rational : IComparable, IComparable<Rational>, 
	IEquatable<Rational>, IFormattable
Request Example View Source

The Rational type exposes the following members.

Constructors
  NameDescription
Public methodRational(Double)
Creates a new Rational instance equal to a floating-point value.
Public methodRational(Int32)
Creates a new Rational instance with a denominator of 1.
Public methodRational(Int32, Int32)
Creates a new Rational instance.
Top
Properties
  NameDescription
Public propertyDenominator
Gets the numerator of the current Rational value.
Public propertyNumerator
Gets the numerator of the current Rational value.
Public propertyValue
Gets the floating-point equivalent of the current Rational value.
Top
Methods
  NameDescription
Public methodStatic memberAbs
Returns the absolute value of a Rational.
Public methodCompareTo(Object)
Compares this instance to another Rational and returns an indication of their relative values.
Public methodCompareTo(Rational)
Compares this instance to another Rational and returns an indication of their relative values.
Public methodStatic memberDivRem
Calculates the quotient of two rational numbers and also returns the remainder in an output parameter.
Public methodEquals(Object)
Indicates whether this instance and a specified object are equal.
(Overrides ValueTypeEquals(Object).)
Public methodEquals(Rational)
Indicates whether this instance and a specified Rational are equal.
Public methodStatic memberFromDecimal
Converts a floating-point number to a rational number.
Public methodStatic memberFromDouble
Converts a floating-point number to a rational number.
Public methodStatic memberFromDoubleWithMaxDenominator
Converts a floating-point decimal to a rational number.
Public methodGetHashCode
Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInverse
Gets the inverse of the current Rational value (that is, one divided by the current value).
Public methodStatic memberIsIndeterminate
Returns a value that indicates whether the specified Rational represents an indeterminate value.
Public methodStatic memberIsInfinity
Returns a value that indicates whether the specified Rational evaluates to positive or negative infinity.
Public methodStatic memberIsNegativeInfinity
Returns a value that indicates whether the specified Rational evaluates to negative infinity.
Public methodStatic memberIsPositiveInfinity
Returns a value that indicates whether the specified Rational evaluates to positive infinity.
Public methodStatic memberIsZero
Returns a value that indicates whether the specified Rational evaluates to zero.
Public methodStatic memberMax
Returns the larger of two Rationals.
Public methodStatic memberMin
Returns the smaller of two Rationals.
Public methodNegate
Gets the negated version of the current Rational value (that is, the current value multiplied by negative one).
Public methodStatic memberParse(String)
Converts the string representation of a number to its Rational representation.
Public methodStatic memberParse(String, NumberStyles)
Converts the string representation of a number to its Rational representation.
Public methodStatic memberParse(String, IFormatProvider)
Converts the string representation of a number to its Rational representation.
Public methodStatic memberParse(String, NumberStyles, IFormatProvider)
Converts the string representation of a number to its Rational representation.
Public methodStatic memberPow
Returns a specified number raised to a specified power.
Public methodStatic memberRound
Rounds a Rational to the nearest integral value.
Public methodSimplify
Gets the simplified version of the rational number.
Public methodStatic memberSimplify(Int32, Int32)
Gets the simplified version of the rational number.
Public methodStatic memberSimplify(Int64, Int64)
Gets the simplified version of the rational number.
Public methodStrictlyEquals
Indicates whether this instance and a specified Rational are strictly equal; that is, the two instances must have equal numerators and denominators.
Public methodToDouble
Converts the current Rational to a double.
Public methodToMixedString
Converts the Rational to a string in the form of a mixed fraction.
Public methodToMixedString(String)
Converts the Rational to a string in the form of a mixed fraction.
Public methodToString
Converts the Rational to a string in the form of an improper fraction.
(Overrides ValueTypeToString.)
Public methodToString(IFormatProvider)
Converts this instance to its equivalent string representation.
Public methodToString(String, IFormatProvider)
Converts this instance to its equivalent string representation.
Public methodStatic memberTryParse(String, Rational)
Converts the string representation of a number to its Rational representation. A return value indicates whether the conversion succeeded or failed.
Public methodStatic memberTryParse(String, NumberStyles, Rational)
Converts the string representation of a number to its Rational representation. A return value indicates whether the conversion succeeded or failed.
Public methodStatic memberTryParse(String, IFormatProvider, Rational)
Converts the string representation of a number to its Rational representation. A return value indicates whether the conversion succeeded or failed.
Public methodStatic memberTryParse(String, NumberStyles, IFormatProvider, Rational)
Converts the string representation of a number to its Rational representation. A return value indicates whether the conversion succeeded or failed.
Top
Operators
  NameDescription
Public operatorStatic memberAddition
Adds two Rational values.
Public operatorStatic memberDecrement
Decrements a Rational value.
Public operatorStatic memberDivision
Divides two Rational values.
Public operatorStatic memberEquality
Gets whether two Rational values are numerically equivalent.
Public operatorStatic member(Decimal to Rational)
Converts the specified Decimal to a Rational.
Public operatorStatic member(Double to Rational)
Converts the specified Double to a Rational.
Public operatorStatic member(Single to Rational)
Converts the specified Single to a Rational.
Public operatorStatic member(Rational to Int32)
Converts the specified Rational to a Int32.
Public operatorStatic member(Rational to UInt32)
Converts the specified Rational to a UInt32.
Public operatorStatic member(Rational to Int16)
Converts the specified Rational to a Int16.
Public operatorStatic member(Rational to UInt16)
Converts the specified Rational to a UInt16.
Public operatorStatic member(Rational to Int64)
Converts the specified Rational to a Int64.
Public operatorStatic member(Rational to UInt64)
Converts the specified Rational to a UInt64.
Public operatorStatic member(Rational to SByte)
Converts the specified Rational to a SByte.
Public operatorStatic member(Rational to Byte)
Converts the specified Rational to a Byte.
Public operatorStatic member(Rational to Single)
Converts the specified Rational to a Single.
Public operatorStatic member(Rational to Double)
Converts the specified Rational to a Double.
Public operatorStatic member(Rational to Decimal)
Converts the specified Rational to a Decimal.
Public operatorStatic memberGreaterThan
Gets whether a Rational values is greater than another.
Public operatorStatic memberGreaterThanOrEqual
Gets whether a Rational values is greater than or equal to another.
Public operatorStatic member(Byte to Rational)
Converts the specified Byte to a Rational.
Public operatorStatic member(Int16 to Rational)
Converts the specified Int16 to a Rational.
Public operatorStatic member(Int32 to Rational)
Converts the specified Int32 to a Rational.
Public operatorStatic member(Int64 to Rational)
Converts the specified Int64 to a Rational.
Public operatorStatic member(SByte to Rational)
Converts the specified SByte to a Rational.
Public operatorStatic member(UInt16 to Rational)
Converts the specified UInt16 to a Rational.
Public operatorStatic member(UInt32 to Rational)
Converts the specified UInt32 to a Rational.
Public operatorStatic member(UInt64 to Rational)
Converts the specified UInt64 to a Rational.
Public operatorStatic memberIncrement
Increments a Rational value.
Public operatorStatic memberInequality
Gets whether two Rational values are numerically not equivalent.
Public operatorStatic memberLessThan
Gets whether a Rational values is less than another.
Public operatorStatic memberLessThanOrEqual
Gets whether a Rational values is less than or equal to another.
Public operatorStatic memberModulus
Gets the remainder that results from dividing two Rational values.
Public operatorStatic memberMultiply
Multiplies two Rational values.
Public operatorStatic memberSubtraction
Subtracts two Rational values.
Public operatorStatic memberUnaryNegation
Gets the negated version of a Rational value.
Public operatorStatic memberUnaryPlus
Gets the Rational value.
Top
Fields
  NameDescription
Public fieldStatic memberEpsilon
Represents the minimum positive value of a Rational.
Public fieldStatic memberIndeterminate
Represents an indeterminate value.
Public fieldStatic memberMaxValue
Represents the maximum finite value of a Rational.
Public fieldStatic memberMinValue
Represents the minimum finite value of a Rational.
Public fieldStatic memberNegativeInfinity
Represents negative infinity.
Public fieldStatic memberOne
Represents the number one.
Public fieldStatic memberPositiveInfinity
Represents positive infinity.
Public fieldStatic memberZero
Represents the number zero.
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
See Also