Property | Type | Description | |
---|---|---|---|
Epsilon | |||
MaxValue | |||
MinValue | |||
NaN | |||
NegativeInfinity | |||
PositiveInfinity | |||
Zero |
Property | Type | Description | |
---|---|---|---|
Add | |||
CompareEquality | bool | ||
ConvertPositiveDouble | |||
Fraction | System | ||
GCD | long | ||
IndeterminantCompare | int | ||
IndeterminateTypeName | string | ||
Modulus | |||
Multiply | |||
Negate | |||
NormalizeIndeterminate | Indeterminates | ||
System | string |
Method | Description | |
---|---|---|
CompareTo ( |
Compares this Fraction to another Fraction
|
|
CompareTo ( object obj ) : int |
Compares an object to this Fraction Will convert an object from longs, doubles, and strings as this is a value-type. |
|
CrossReducePair ( |
Cross-reduces a pair of Fractions so that we have the best GCD-reduced values for multiplication Modifies the input arguments in-place! |
|
Equals ( object obj ) : bool |
Compares for equality the current Fraction to the value passed.
|
|
Fraction ( ) : System |
Default constructor; default value is NaN.
|
|
Fraction ( |
Construct a Fraction from another fraction
|
|
Fraction ( double floatingPointNumber ) : System |
Construct a Fraction from a floating-point value
|
|
Fraction ( long wholeNumber ) : System |
Construct a Fraction from an integral value The denominator will be 1 |
|
Fraction ( long numerator, long denominator ) : System |
Construct a Fraction from a numerator, denominator pair Will reduce the fraction to smallest possible denominator |
|
Fraction ( string inValue ) : System |
Construct a Fraction from a string in any legal format Will reduce the fraction to smallest possible denominator |
|
GetHashCode ( ) : int |
Returns a hash code generated from the current Fraction Reduces (in-place) the Fraction first. |
|
Inverse ( ) : |
Inverts a Fraction Does NOT throw for zero Numerators as later use of the fraction will catch the error. |
|
Inverted ( double value ) : |
Creates an inverted Fraction Does NOT throw for zero Numerators as later use of the fraction will catch the error. |
|
Inverted ( long value ) : |
Creates an inverted Fraction Does NOT throw for zero Numerators as later use of the fraction will catch the error. |
|
IsInfinity ( ) : bool |
Determines if a Fraction represents Any Infinity
|
|
IsNaN ( ) : bool |
Determines if a Fraction represents a Not-a-Number
|
|
IsNegativeInfinity ( ) : bool |
Determines if a Fraction represents Negative Infinity
|
|
IsPositiveInfinity ( ) : bool |
Determines if a Fraction represents Positive Infinity
|
|
ReduceFraction ( |
Reduces (simplifies) a Fraction by dividing down to lowest possible denominator (via GCD) Modifies the input arguments in-place! Will normalize the NaN and infinites representation. Will set Denominator to 1 for any zero numerator. Moves sign to the Numerator. |
|
ToDouble ( ) : double |
Get the value of the Fraction object as double with full support for NaNs and infinities
|
|
ToFraction ( double inValue ) : |
Converts a double value to the approximate Fraction Supports double.NaN, double.PositiveInfinity and double.NegativeInfinity |
|
ToFraction ( long inValue ) : |
Converts a long value to the exact Fraction
|
|
ToFraction ( string inValue ) : |
Converts a string to the corresponding reduced fraction Four forms are supported, as a plain integer, as a double, or as Numerator/Denominator and the representations for NaN and the infinites |
|
ToInt32 ( ) : |
Get the integral value of the Fraction object as int/Int32 If the value is not a true integer, the fractional part is discarded (truncated toward zero). If the valid exceeds the range of an Int32 and exception is thrown. |
|
ToInt64 ( ) : System.Int64 |
Get the integral value of the Fraction object as long/Int64 If the value is not a true integer, the fractional part is discarded (truncated toward zero). If the valid exceeds the range of an Int32, no special handling is guaranteed. |
|
ToString ( ) : string |
Get the value of the Fraction as a string, with proper representation for NaNs and infinites The current culture determines the textual representation the Indeterminates |
|
operator ( ) : |
||
operator ( ) : bool |
Method | Description | |
---|---|---|
Add ( |
Adds two Fractions
|
|
CompareEquality ( |
Compares for equality the current Fraction to the value passed.
|
|
ConvertPositiveDouble ( int sign, double inValue ) : |
||
Fraction ( Indeterminates type ) : System |
Private constructor to synthesize a Fraction for indeterminates (NaN and infinites)
|
|
GCD ( long left, long right ) : long |
Computes the greatest common divisor for two values
|
|
IndeterminantCompare ( Indeterminates leftType, |
Determines how this Fraction, of an indeterminate type, compares to another Fraction NaN is less than anything except NaN and Negative Infinity. Negative Infinity is less than anything except Negative Infinity. Positive Infinity is greater than anything except Positive Infinity. |
|
IndeterminateTypeName ( long numerator ) : string |
Gives the culture-related representation of the indeterminate types NaN, PositiveInfinity and NegativeInfinity Only the sign and zero/non-zero information is relevant. |
|
Modulus ( |
Returns the modulus (remainder after dividing) two Fractions
|
|
Multiply ( |
Multiplies two Fractions
|
|
Negate ( |
Negates the Fraction
|
|
NormalizeIndeterminate ( long numerator ) : Indeterminates |
Gives the normalize representation of the indeterminate types NaN, PositiveInfinity and NegativeInfinity Only the sign and zero/non-zero information is relevant. |
|
System ( string format, IFormatProvider formatProvider ) : string |
public CompareTo ( |
||
right | The Fraction to compare against | |
return | int |
public CompareTo ( object obj ) : int | ||
obj | object | The object to compare against (null is less than everything) |
return | int |
public static CrossReducePair ( |
||
frac1 | The first Fraction [WILL BE MODIFIED IN PLACE] | |
frac2 | The second Fraction [WILL BE MODIFIED IN PLACE] | |
return | void |
public Fraction ( double floatingPointNumber ) : System | ||
floatingPointNumber | double | The value |
return | System |
public Fraction ( long wholeNumber ) : System | ||
wholeNumber | long | The value (eventual numerator) |
return | System |
public Fraction ( long numerator, long denominator ) : System | ||
numerator | long | The numerator (top number) |
denominator | long | The denominator (bottom number) |
return | System |
public Fraction ( string inValue ) : System | ||
inValue | string | A string with a legal fraction input format |
return | System |
public static Inverted ( double value ) : |
||
value | double | |
return |
public static Inverted ( long value ) : |
||
value | long | |
return |
public static ReduceFraction ( |
||
frac | The Fraction to be reduced [WILL BE MODIFIED IN PLACE] | |
return | void |
public static ToFraction ( double inValue ) : |
||
inValue | double | The double to convert |
return |
public static ToFraction ( long inValue ) : |
||
inValue | long | The long to convert |
return |
public static ToFraction ( string inValue ) : |
||
inValue | string | The string representation of a fractional value |
return |
public static Fraction,Spontaneous.DataModel MaxValue | ||
return |
public static Fraction,Spontaneous.DataModel MinValue | ||
return |
public static Fraction,Spontaneous.DataModel NegativeInfinity | ||
return |
public static Fraction,Spontaneous.DataModel PositiveInfinity | ||
return |