Craig's Utility Library
4.0 Beta
|
Represents a fraction More...
Public Member Functions | |
Fraction (int Numerator, int Denominator) | |
Constructor More... | |
Fraction (double Numerator, double Denominator) | |
Constructor More... | |
Fraction (decimal Numerator, decimal Denominator) | |
Constructor More... | |
Fraction (float Numerator, float Denominator) | |
Constructor More... | |
override bool | Equals (object obj) |
Determines if the fractions are equal More... | |
override int | GetHashCode () |
Gets the hash code of the fraction More... | |
Fraction | Inverse () |
Returns the inverse of the fraction More... | |
void | Reduce () |
Reduces the fraction (finds the greatest common denominator and divides the numerator/denominator by it). More... | |
override string | ToString () |
Displays the fraction as a string More... | |
Static Public Member Functions | |
static implicit | operator decimal (Fraction Fraction) |
Converts the fraction to a decimal More... | |
static implicit | operator double (Fraction Fraction) |
Converts the fraction to a double More... | |
static implicit | operator float (Fraction Fraction) |
Converts the fraction to a float More... | |
static implicit | operator Fraction (double Fraction) |
Converts the double to a fraction More... | |
static implicit | operator Fraction (decimal Fraction) |
Converts the decimal to a fraction More... | |
static implicit | operator Fraction (float Fraction) |
Converts the float to a fraction More... | |
static implicit | operator Fraction (int Fraction) |
Converts the int to a fraction More... | |
static implicit | operator Fraction (uint Fraction) |
Converts the uint to a fraction More... | |
static implicit | operator string (Fraction Fraction) |
Converts the fraction to a string More... | |
static Fraction | operator- (Fraction First, Fraction Second) |
Subtraction More... | |
static Fraction | operator- (Fraction First) |
Negation of the fraction More... | |
static bool | operator!= (Fraction First, Fraction Second) |
Not equals operator More... | |
static bool | operator!= (Fraction First, double Second) |
Not equals operator More... | |
static bool | operator!= (double First, Fraction Second) |
Not equals operator More... | |
static Fraction | operator* (Fraction First, Fraction Second) |
Multiplication More... | |
static Fraction | operator/ (Fraction First, Fraction Second) |
Division More... | |
static Fraction | operator+ (Fraction First, Fraction Second) |
Addition More... | |
static bool | operator== (Fraction First, Fraction Second) |
Equals operator More... | |
static bool | operator== (Fraction First, double Second) |
Equals operator More... | |
static bool | operator== (double First, Fraction Second) |
Equals operator More... | |
Properties | |
int | Denominator [get, set] |
Denominator of the fraction More... | |
int | Numerator [get, set] |
Numerator of the faction More... | |
Represents a fraction
Definition at line 31 of file Fraction.cs.
Utilities.DataTypes.Fraction.Fraction | ( | int | Numerator, |
int | Denominator | ||
) |
Constructor
Numerator | Numerator |
Denominator | Denominator |
Definition at line 38 of file Fraction.cs.
Utilities.DataTypes.Fraction.Fraction | ( | double | Numerator, |
double | Denominator | ||
) |
Constructor
Numerator | Numerator |
Denominator | Denominator |
Definition at line 49 of file Fraction.cs.
Utilities.DataTypes.Fraction.Fraction | ( | decimal | Numerator, |
decimal | Denominator | ||
) |
Constructor
Numerator | Numerator |
Denominator | Denominator |
Definition at line 69 of file Fraction.cs.
Utilities.DataTypes.Fraction.Fraction | ( | float | Numerator, |
float | Denominator | ||
) |
Constructor
Numerator | Numerator |
Denominator | Denominator |
Definition at line 87 of file Fraction.cs.
override bool Utilities.DataTypes.Fraction.Equals | ( | object | obj | ) |
Determines if the fractions are equal
obj | object to check |
Definition at line 352 of file Fraction.cs.
override int Utilities.DataTypes.Fraction.GetHashCode | ( | ) |
Gets the hash code of the fraction
Definition at line 366 of file Fraction.cs.
Fraction Utilities.DataTypes.Fraction.Inverse | ( | ) |
|
static |
Converts the fraction to a decimal
Definition at line 118 of file Fraction.cs.
|
static |
Converts the fraction to a double
Definition at line 129 of file Fraction.cs.
|
static |
Converts the fraction to a float
Definition at line 140 of file Fraction.cs.
|
static |
Converts the double to a fraction
Definition at line 151 of file Fraction.cs.
|
static |
Converts the decimal to a fraction
Definition at line 161 of file Fraction.cs.
|
static |
Converts the float to a fraction
Definition at line 171 of file Fraction.cs.
|
static |
Converts the int to a fraction
Definition at line 181 of file Fraction.cs.
|
static |
Converts the uint to a fraction
Definition at line 192 of file Fraction.cs.
|
static |
Converts the fraction to a string
Definition at line 202 of file Fraction.cs.
Not equals operator
First | First item |
Second | Second item |
Definition at line 242 of file Fraction.cs.
|
static |
Not equals operator
First | First item |
Second | Second item |
Definition at line 253 of file Fraction.cs.
|
static |
Not equals operator
First | First item |
Second | Second item |
Definition at line 264 of file Fraction.cs.
Multiplication
First | First fraction |
Second | Second fraction |
Definition at line 275 of file Fraction.cs.
Addition
First | First fraction |
Second | Second fraction |
Definition at line 303 of file Fraction.cs.
Subtraction
First | First fraction |
Second | Second fraction |
Definition at line 214 of file Fraction.cs.
Negation of the fraction
First | Fraction to negate |
Definition at line 230 of file Fraction.cs.
Division
First | First item |
Second | Second item |
Definition at line 290 of file Fraction.cs.
Equals operator
First | First item |
Second | Second item |
Definition at line 320 of file Fraction.cs.
|
static |
Equals operator
First | First item |
Second | Second item |
Definition at line 331 of file Fraction.cs.
|
static |
Equals operator
First | First item |
Second | Second item |
Definition at line 342 of file Fraction.cs.
void Utilities.DataTypes.Fraction.Reduce | ( | ) |
Reduces the fraction (finds the greatest common denominator and divides the numerator/denominator by it).
Definition at line 384 of file Fraction.cs.
override string Utilities.DataTypes.Fraction.ToString | ( | ) |
Displays the fraction as a string
Definition at line 400 of file Fraction.cs.
|
getset |
Denominator of the fraction
Definition at line 106 of file Fraction.cs.
|
getset |
Numerator of the faction
Definition at line 111 of file Fraction.cs.