This documentation is compiled for the latest release of Mathos Core Library
Assembly: Mathos (in Mathos.dll) Version: 1.0.5.1 (1.0.5.1)
Top
Top
Top
Top
Top
The Fraction type makes it possible to store numbers in form of p/q, where p,q are integers.
The integer is stored as Int64 (long).
Namespace: Mathos.Arithmetic.Fractions
Assembly: Mathos (in Mathos.dll) Version: 1.0.5.1 (1.0.5.1)
Syntax
The Fraction type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| Fraction(Int64) | Initializes a new instance of the Fraction class | |
| Fraction(String) | Initializes a new instance of the Fraction class | |
| Fraction(Int64, Int64) | Initializes a new instance of the Fraction class | |
| Fraction(Fraction, Fraction) | Initializes a new instance of the Fraction class |
Methods
| Name | Description | |
|---|---|---|
| Equals | (Overrides ValueTypeEquals(Object).) | |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
| FromSternBrocotSystem |
Convert a fraction in Stern-Brocot system to a fraction.
| |
| GetHashCode | (Overrides ValueTypeGetHashCode.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| Inverse |
Find the invers
| |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| Simplify |
Simplify a fraction
| |
| ToCondensedSternBrocotSystem |
This method will convert a SternBrocot represented fraction, eg. LLRRLR and convert it to a condensed form.
| |
| ToDecimal | ||
| ToDouble | ||
| ToInt64 | ||
| ToSternBrocotSystem |
Convert the fraction into a Stern-Brocot system
| |
| ToSternBrocotSystem(Decimal, Boolean, Int32) |
Converts a decimal to Stern-Brocot number system consisting of L's and R's. In order to convert a fraction, use the non-static method inside the fraction class.
| |
| ToString | (Overrides ValueTypeToString.) |
Operators
| Name | Description | |
|---|---|---|
| Addition(Int64, Fraction) |
Addition
| |
| Addition(Fraction, Fraction) |
Addition
| |
| Division |
Division
| |
| Equality |
The equalto operator
| |
| GreaterThan |
The more-than operator
| |
| GreaterThanOrEqual |
The more-than or equalto operator
| |
| (Int64 to Fraction) | ||
| (String to Fraction) | ||
| (Fraction to Decimal) | ||
| Inequality |
The not-equalto operator
| |
| LessThan |
The less-than operator
| |
| LessThanOrEqual |
The less-than or equalto operator
| |
| Multiply |
Multiplication
| |
| Subtraction(Int64, Fraction) |
Subtraction
NOTE: This operator is calling itself!
| |
| Subtraction(Fraction, Fraction) |
Subtraction
| |
| Subtraction(Fraction, Int64) |
Subtraction
|
Extension Methods
| Name | Description | |
|---|---|---|
| From(Enum) | Overloaded. (Defined by Converter.) | |
| From(Base) | Overloaded. (Defined by Converter.) |
Properties
| Name | Description | |
|---|---|---|
| Denominator |
Gets or sets the "_denominator"
| |
| Numerator |
Gets or sets the "_numerator"
|
See Also