Struct MathEx.Fraction32
Represents a generic rational number represented by 32-bit signed numerator and denominator.
Implements
System.IComparable
System.IFormattable
Assembly: ExifLibrary.dll
Syntax
public struct Fraction32 : IComparable, IFormattable, IComparable<MathEx.Fraction32>, IEquatable<MathEx.Fraction32>
Constructors
|
Improve this Doc
View Source
Fraction32(MathEx.Fraction32)
Declaration
public Fraction32(MathEx.Fraction32 f)
Parameters
|
Improve this Doc
View Source
Fraction32(Double)
Declaration
public Fraction32(double value)
Parameters
Type |
Name |
Description |
System.Double |
value |
|
|
Improve this Doc
View Source
Fraction32(Int32)
Declaration
public Fraction32(int numerator)
Parameters
Type |
Name |
Description |
System.Int32 |
numerator |
|
|
Improve this Doc
View Source
Fraction32(Int32, Int32)
Declaration
public Fraction32(int numerator, int denominator)
Parameters
Type |
Name |
Description |
System.Int32 |
numerator |
|
System.Int32 |
denominator |
|
|
Improve this Doc
View Source
Fraction32(Single)
Declaration
public Fraction32(float value)
Parameters
Type |
Name |
Description |
System.Single |
value |
|
|
Improve this Doc
View Source
Fraction32(String)
Declaration
public Fraction32(string s)
Parameters
Type |
Name |
Description |
System.String |
s |
|
Fields
|
Improve this Doc
View Source
NaN
Declaration
public static readonly MathEx.Fraction32 NaN
Field Value
|
Improve this Doc
View Source
NegativeInfinity
Declaration
public static readonly MathEx.Fraction32 NegativeInfinity
Field Value
|
Improve this Doc
View Source
PositiveInfinity
Declaration
public static readonly MathEx.Fraction32 PositiveInfinity
Field Value
Properties
|
Improve this Doc
View Source
Denominator
Gets or sets the denominator.
Declaration
public int Denominator { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Error
Declaration
public double Error { get; }
Property Value
Type |
Description |
System.Double |
|
|
Improve this Doc
View Source
IsNegative
Gets or sets a value determining id the fraction is a negative value.
Declaration
public bool IsNegative { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Numerator
Gets or sets the numerator.
Declaration
public int Numerator { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
|
Improve this Doc
View Source
CompareTo(MathEx.Fraction32)
Compares this instance to a specified object and returns an indication of
their relative values.
Declaration
public int CompareTo(MathEx.Fraction32 obj)
Parameters
Type |
Name |
Description |
MathEx.Fraction32 |
obj |
An fraction to compare with this instance.
|
Returns
Type |
Description |
System.Int32 |
A signed number indicating the relative values of this instance and value.
Less than zero: This instance is less than obj.
Zero: This instance is equal to obj.
Greater than zero: This instance is greater than obj or obj is null.
|
|
Improve this Doc
View Source
CompareTo(Object)
Compares this instance to a specified object and returns an indication of
their relative values.
Declaration
public int CompareTo(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
An object to compare, or null.
|
Returns
Type |
Description |
System.Int32 |
A signed number indicating the relative values of this instance and value.
Less than zero: This instance is less than obj.
Zero: This instance is equal to obj.
Greater than zero: This instance is greater than obj or obj is null.
|
Exceptions
Type |
Condition |
System.ArgumentException |
obj is not a Fraction.
|
|
Improve this Doc
View Source
Equals(MathEx.Fraction32)
Indicates whether this instance and a specified object are equal value-wise.
Declaration
public bool Equals(MathEx.Fraction32 obj)
Parameters
Returns
Type |
Description |
System.Boolean |
true if obj and this instance represent the same value;
otherwise, false.
|
|
Improve this Doc
View Source
Equals(Object)
Indicates whether this instance and a specified object are equal value-wise.
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
Another object to compare to.
|
Returns
Type |
Description |
System.Boolean |
true if obj and this instance are the same type and represent
the same value; otherwise, false.
|
Overrides
System.ValueType.Equals(System.Object)
|
Improve this Doc
View Source
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
A 32-bit signed integer that is the hash code for this instance.
|
Overrides
System.ValueType.GetHashCode()
|
Improve this Doc
View Source
Inverse(MathEx.Fraction32)
Returns the multiplicative inverse of a given value.
Declaration
public static MathEx.Fraction32 Inverse(MathEx.Fraction32 f)
Parameters
Returns
|
Improve this Doc
View Source
IsInfinity(MathEx.Fraction32)
Returns a value indicating whether the specified number evaluates to negative
or positive infinity.
Declaration
public static bool IsInfinity(MathEx.Fraction32 f)
Parameters
Returns
Type |
Description |
System.Boolean |
true if f evaluates to Fraction.NegativeInfinity or Fraction.PositiveInfinity; otherwise, false.
|
|
Improve this Doc
View Source
IsNan(MathEx.Fraction32)
Returns a value indicating whether the specified number evaluates to a value
that is not a number.
Declaration
public static bool IsNan(MathEx.Fraction32 f)
Parameters
Returns
Type |
Description |
System.Boolean |
true if f evaluates to Fraction.NaN; otherwise, false.
|
|
Improve this Doc
View Source
IsNegativeInfinity(MathEx.Fraction32)
Returns a value indicating whether the specified number evaluates to negative
infinity.
Declaration
public static bool IsNegativeInfinity(MathEx.Fraction32 f)
Parameters
Returns
Type |
Description |
System.Boolean |
true if f evaluates to Fraction.NegativeInfinity; otherwise, false.
|
|
Improve this Doc
View Source
IsPositiveInfinity(MathEx.Fraction32)
Returns a value indicating whether the specified number evaluates to positive
infinity.
Declaration
public static bool IsPositiveInfinity(MathEx.Fraction32 f)
Parameters
Returns
Type |
Description |
System.Boolean |
true if f evaluates to Fraction.PositiveInfinity; otherwise, false.
|
|
Improve this Doc
View Source
Parse(String)
Converts the string representation of a fraction to a fraction object.
Declaration
public static MathEx.Fraction32 Parse(string s)
Parameters
Type |
Name |
Description |
System.String |
s |
A string formatted as numerator/denominator
|
Returns
Exceptions
Type |
Condition |
System.ArgumentNullException |
s is null
|
System.FormatException |
s is not in the correct format
|
System.OverflowException |
s represents a number less than System.UInt32.MinValue or greater than
System.UInt32.MaxValue.
|
|
Improve this Doc
View Source
Set(Int32, Int32)
Sets the value of this instance to the fraction represented
by the given numerator and denominator.
Declaration
public void Set(int numerator, int denominator)
Parameters
Type |
Name |
Description |
System.Int32 |
numerator |
The new numerator.
|
System.Int32 |
denominator |
The new denominator.
|
|
Improve this Doc
View Source
ToString()
Returns a string representation of the fraction.
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
A string formatted as numerator/denominator.
|
Overrides
System.ValueType.ToString()
|
Improve this Doc
View Source
Returns a string representation of the fraction.
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
Type |
Name |
Description |
System.IFormatProvider |
formatProvider |
An System.IFormatProvider that supplies culture-specific
formatting information.
|
Returns
Type |
Description |
System.String |
The string representation of the value of this instance as
specified by provider.
|
|
Improve this Doc
View Source
ToString(String)
Returns a string representation of the fraction.
Declaration
public string ToString(string format)
Parameters
Type |
Name |
Description |
System.String |
format |
A numeric format string.
|
Returns
Type |
Description |
System.String |
The string representation of the value of this instance as
specified by format.
|
Exceptions
Type |
Condition |
System.FormatException |
format is invalid or not supported.
|
|
Improve this Doc
View Source
Returns a string representation of the fraction.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type |
Name |
Description |
System.String |
format |
A numeric format string.
|
System.IFormatProvider |
formatProvider |
An System.IFormatProvider that supplies culture-specific
formatting information.
|
Returns
Type |
Description |
System.String |
The string representation of the value of this instance as
specified by format and provider.
|
Exceptions
Type |
Condition |
System.FormatException |
format is invalid or not supported.
|
|
Improve this Doc
View Source
TryParse(String, out MathEx.Fraction32)
Converts the string representation of a fraction to a fraction object.
A return value indicates whether the conversion succeeded.
Declaration
public static bool TryParse(string s, out MathEx.Fraction32 f)
Parameters
Type |
Name |
Description |
System.String |
s |
A string formatted as numerator/denominator
|
MathEx.Fraction32 |
f |
|
Returns
Type |
Description |
System.Boolean |
true if s was converted successfully; otherwise, false.
|
Operators
|
Improve this Doc
View Source
Addition(MathEx.Fraction32, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator +(MathEx.Fraction32 f1, MathEx.Fraction32 f2)
Parameters
Returns
|
Improve this Doc
View Source
Addition(MathEx.Fraction32, Double)
Declaration
public static MathEx.Fraction32 operator +(MathEx.Fraction32 f, double n)
Parameters
Returns
|
Improve this Doc
View Source
Addition(MathEx.Fraction32, Int32)
Declaration
public static MathEx.Fraction32 operator +(MathEx.Fraction32 f, int n)
Parameters
Returns
|
Improve this Doc
View Source
Addition(MathEx.Fraction32, Single)
Declaration
public static MathEx.Fraction32 operator +(MathEx.Fraction32 f, float n)
Parameters
Returns
|
Improve this Doc
View Source
Addition(Double, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator +(double n, MathEx.Fraction32 f)
Parameters
Returns
|
Improve this Doc
View Source
Addition(Int32, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator +(int n, MathEx.Fraction32 f)
Parameters
Returns
|
Improve this Doc
View Source
Addition(Single, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator +(float n, MathEx.Fraction32 f)
Parameters
Returns
|
Improve this Doc
View Source
Decrement(MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator --(MathEx.Fraction32 f)
Parameters
Returns
|
Improve this Doc
View Source
Division(MathEx.Fraction32, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator /(MathEx.Fraction32 f1, MathEx.Fraction32 f2)
Parameters
Returns
|
Improve this Doc
View Source
Division(MathEx.Fraction32, Double)
Declaration
public static MathEx.Fraction32 operator /(MathEx.Fraction32 f, double n)
Parameters
Returns
|
Improve this Doc
View Source
Division(MathEx.Fraction32, Int32)
Declaration
public static MathEx.Fraction32 operator /(MathEx.Fraction32 f, int n)
Parameters
Returns
|
Improve this Doc
View Source
Division(MathEx.Fraction32, Single)
Declaration
public static MathEx.Fraction32 operator /(MathEx.Fraction32 f, float n)
Parameters
Returns
|
Improve this Doc
View Source
Equality(MathEx.Fraction32, MathEx.Fraction32)
Declaration
public static bool operator ==(MathEx.Fraction32 f1, MathEx.Fraction32 f2)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Explicit(MathEx.Fraction32 to Double)
Declaration
public static explicit operator double (MathEx.Fraction32 f)
Parameters
Returns
Type |
Description |
System.Double |
|
|
Improve this Doc
View Source
Explicit(MathEx.Fraction32 to Int32)
Declaration
public static explicit operator int (MathEx.Fraction32 f)
Parameters
Returns
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Explicit(MathEx.Fraction32 to Single)
Declaration
public static explicit operator float (MathEx.Fraction32 f)
Parameters
Returns
Type |
Description |
System.Single |
|
|
Improve this Doc
View Source
GreaterThan(MathEx.Fraction32, MathEx.Fraction32)
Declaration
public static bool operator>(MathEx.Fraction32 f1, MathEx.Fraction32 f2)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Increment(MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator ++(MathEx.Fraction32 f)
Parameters
Returns
|
Improve this Doc
View Source
Inequality(MathEx.Fraction32, MathEx.Fraction32)
Declaration
public static bool operator !=(MathEx.Fraction32 f1, MathEx.Fraction32 f2)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
LessThan(MathEx.Fraction32, MathEx.Fraction32)
Declaration
public static bool operator <(MathEx.Fraction32 f1, MathEx.Fraction32 f2)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Multiply(MathEx.Fraction32, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator *(MathEx.Fraction32 f1, MathEx.Fraction32 f2)
Parameters
Returns
|
Improve this Doc
View Source
Multiply(MathEx.Fraction32, Double)
Declaration
public static MathEx.Fraction32 operator *(MathEx.Fraction32 f, double n)
Parameters
Returns
|
Improve this Doc
View Source
Multiply(MathEx.Fraction32, Int32)
Declaration
public static MathEx.Fraction32 operator *(MathEx.Fraction32 f, int n)
Parameters
Returns
|
Improve this Doc
View Source
Multiply(MathEx.Fraction32, Single)
Declaration
public static MathEx.Fraction32 operator *(MathEx.Fraction32 f, float n)
Parameters
Returns
|
Improve this Doc
View Source
Multiply(Double, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator *(double n, MathEx.Fraction32 f)
Parameters
Returns
|
Improve this Doc
View Source
Multiply(Int32, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator *(int n, MathEx.Fraction32 f)
Parameters
Returns
|
Improve this Doc
View Source
Multiply(Single, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator *(float n, MathEx.Fraction32 f)
Parameters
Returns
|
Improve this Doc
View Source
Subtraction(MathEx.Fraction32, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator -(MathEx.Fraction32 f1, MathEx.Fraction32 f2)
Parameters
Returns
|
Improve this Doc
View Source
Subtraction(MathEx.Fraction32, Double)
Declaration
public static MathEx.Fraction32 operator -(MathEx.Fraction32 f, double n)
Parameters
Returns
|
Improve this Doc
View Source
Subtraction(MathEx.Fraction32, Int32)
Declaration
public static MathEx.Fraction32 operator -(MathEx.Fraction32 f, int n)
Parameters
Returns
|
Improve this Doc
View Source
Subtraction(MathEx.Fraction32, Single)
Declaration
public static MathEx.Fraction32 operator -(MathEx.Fraction32 f, float n)
Parameters
Returns
|
Improve this Doc
View Source
Subtraction(Double, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator -(double n, MathEx.Fraction32 f)
Parameters
Returns
|
Improve this Doc
View Source
Subtraction(Int32, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator -(int n, MathEx.Fraction32 f)
Parameters
Returns
|
Improve this Doc
View Source
Subtraction(Single, MathEx.Fraction32)
Declaration
public static MathEx.Fraction32 operator -(float n, MathEx.Fraction32 f)
Parameters
Returns
Implements
System.IComparable
System.IFormattable
System.IComparable<T>
System.IEquatable<T>