Rational Structure 
Namespace: Accord.Math
[SerializableAttribute] [TypeConverterAttribute(typeof(RationalConverter))] public struct Rational : IComparable, IComparable<Rational>, IEquatable<Rational>, IFormattable
The Rational type exposes the following members.
Name  Description  

Rational(Double) 
Creates a new Rational instance equal to a floatingpoint value.
 
Rational(Int32) 
Creates a new Rational instance with a denominator of 1.
 
Rational(Int32, Int32) 
Creates a new Rational instance.

Name  Description  

Denominator 
Gets the numerator of the current Rational value.
 
Numerator 
Gets the numerator of the current Rational value.
 
Value 
Gets the floatingpoint equivalent of the current Rational value.

Name  Description  

Abs 
Returns the absolute value of a Rational.
 
CompareTo(Object) 
Compares this instance to another Rational and returns an indication of their relative values.
 
CompareTo(Rational) 
Compares this instance to another Rational and returns an indication of their relative values.
 
DivRem 
Calculates the quotient of two rational numbers and also returns the remainder in an output parameter.
 
Equals(Object) 
Indicates whether this instance and a specified object are equal.
(Overrides ValueTypeEquals(Object).)  
Equals(Rational) 
Indicates whether this instance and a specified Rational are equal.
 
FromDecimal 
Converts a floatingpoint number to a rational number.
 
FromDouble 
Converts a floatingpoint number to a rational number.
 
FromDoubleWithMaxDenominator 
Converts a floatingpoint decimal to a rational number.
 
GetHashCode 
Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
Inverse 
Gets the inverse of the current Rational value (that is, one divided by the current value).
 
IsIndeterminate 
Returns a value that indicates whether the specified Rational represents an indeterminate value.
 
IsInfinity 
Returns a value that indicates whether the specified Rational evaluates to positive or negative infinity.
 
IsNegativeInfinity 
Returns a value that indicates whether the specified Rational evaluates to negative infinity.
 
IsPositiveInfinity 
Returns a value that indicates whether the specified Rational evaluates to positive infinity.
 
IsZero 
Returns a value that indicates whether the specified Rational evaluates to zero.
 
Max 
Returns the larger of two Rationals.
 
Min 
Returns the smaller of two Rationals.
 
Negate 
Gets the negated version of the current Rational value (that is, the current value multiplied by negative one).
 
Parse(String) 
Converts the string representation of a number to its Rational representation.
 
Parse(String, NumberStyles) 
Converts the string representation of a number to its Rational representation.
 
Parse(String, IFormatProvider) 
Converts the string representation of a number to its Rational representation.
 
Parse(String, NumberStyles, IFormatProvider) 
Converts the string representation of a number to its Rational representation.
 
Pow 
Returns a specified number raised to a specified power.
 
Round 
Rounds a Rational to the nearest integral value.
 
Simplify 
Gets the simplified version of the rational number.
 
Simplify(Int32, Int32) 
Gets the simplified version of the rational number.
 
Simplify(Int64, Int64) 
Gets the simplified version of the rational number.
 
StrictlyEquals 
Indicates whether this instance and a specified Rational are strictly equal; that is, the two instances must have equal numerators and denominators.
 
ToDouble 
Converts the current Rational to a double.
 
ToMixedString 
Converts the Rational to a string in the form of a mixed fraction.
 
ToMixedString(String) 
Converts the Rational to a string in the form of a mixed fraction.
 
ToString 
Converts the Rational to a string in the form of an improper fraction.
(Overrides ValueTypeToString.)  
ToString(IFormatProvider) 
Converts this instance to its equivalent string representation.
 
ToString(String, IFormatProvider) 
Converts this instance to its equivalent string representation.
 
TryParse(String, Rational) 
Converts the string representation of a number to its Rational representation. A return value indicates whether the conversion succeeded or failed.
 
TryParse(String, NumberStyles, Rational) 
Converts the string representation of a number to its Rational representation. A return value indicates whether the conversion succeeded or failed.
 
TryParse(String, IFormatProvider, Rational) 
Converts the string representation of a number to its Rational representation. A return value indicates whether the conversion succeeded or failed.
 
TryParse(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.

Name  Description  

Addition 
Adds two Rational values.
 
Decrement 
Decrements a Rational value.
 
Division 
Divides two Rational values.
 
Equality 
Gets whether two Rational values are numerically equivalent.
 
(Decimal to Rational) 
Converts the specified Decimal to a Rational.
 
(Double to Rational) 
Converts the specified Double to a Rational.
 
(Single to Rational) 
Converts the specified Single to a Rational.
 
(Rational to Int32) 
Converts the specified Rational to a Int32.
 
(Rational to UInt32) 
Converts the specified Rational to a UInt32.
 
(Rational to Int16) 
Converts the specified Rational to a Int16.
 
(Rational to UInt16) 
Converts the specified Rational to a UInt16.
 
(Rational to Int64) 
Converts the specified Rational to a Int64.
 
(Rational to UInt64) 
Converts the specified Rational to a UInt64.
 
(Rational to SByte) 
Converts the specified Rational to a SByte.
 
(Rational to Byte) 
Converts the specified Rational to a Byte.
 
(Rational to Single) 
Converts the specified Rational to a Single.
 
(Rational to Double) 
Converts the specified Rational to a Double.
 
(Rational to Decimal) 
Converts the specified Rational to a Decimal.
 
GreaterThan 
Gets whether a Rational values is greater than another.
 
GreaterThanOrEqual 
Gets whether a Rational values is greater than or equal to another.
 
(Byte to Rational) 
Converts the specified Byte to a Rational.
 
(Int16 to Rational) 
Converts the specified Int16 to a Rational.
 
(Int32 to Rational) 
Converts the specified Int32 to a Rational.
 
(Int64 to Rational) 
Converts the specified Int64 to a Rational.
 
(SByte to Rational) 
Converts the specified SByte to a Rational.
 
(UInt16 to Rational) 
Converts the specified UInt16 to a Rational.
 
(UInt32 to Rational) 
Converts the specified UInt32 to a Rational.
 
(UInt64 to Rational) 
Converts the specified UInt64 to a Rational.
 
Increment 
Increments a Rational value.
 
Inequality 
Gets whether two Rational values are numerically not equivalent.
 
LessThan 
Gets whether a Rational values is less than another.
 
LessThanOrEqual 
Gets whether a Rational values is less than or equal to another.
 
Modulus 
Gets the remainder that results from dividing two Rational values.
 
Multiply 
Multiplies two Rational values.
 
Subtraction 
Subtracts two Rational values.
 
UnaryNegation 
Gets the negated version of a Rational value.
 
UnaryPlus 
Gets the Rational value.

Name  Description  

Epsilon 
Represents the minimum positive value of a Rational.
 
Indeterminate 
Represents an indeterminate value.
 
MaxValue 
Represents the maximum finite value of a Rational.
 
MinValue 
Represents the minimum finite value of a Rational.
 
NegativeInfinity 
Represents negative infinity.
 
One 
Represents the number one.
 
PositiveInfinity 
Represents positive infinity.
 
Zero 
Represents the number zero.

Name  Description  

HasMethod 
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)  
IsEqual 
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.)  
To(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.)  
ToT  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.) 