BigRational Structure

Represents an arbitrary rational number.

Definition

Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
[SerializableAttribute]
public readonly struct BigRational : IComparable, 
	IFormattable, IEquatable<BigRational>, IComparable<BigRational>, 
	IComparable<BigInteger>, IComparable<int>
Inheritance
Object  →  ValueType  →  BigRational
Implements
IComparable, IComparable<BigRational>, IComparable<BigInteger>, IComparable<Int32>, IEquatable<BigRational>, IFormattable

Remarks

Use the BigRational class to represent a fraction of integers of arbitrary precision. BigRational objects are immutable.

The Numerator and Denominator return the parts of the fraction. The numerator and the denominator have no common divisors. The denominator is always positive. Zero is represented as 0 / 1.

Constructors

BigRational(BigInteger) Constructs a new BigInteger from two arbitrary precision integers.
BigRational(BigInteger, BigInteger) Constructs a new BigRational from an arbitrary precision numerator and denominator.
BigRational(Int32, Int32) Constructs a new BigRational from an integer numerator and denominator.

Properties

Denominator Gets the denominator of the rational number.
IsOne Gets whether the rational number is equal to one.
IsZero Gets whether the rational number is equal to zero.
Numerator Gets the numerator of the rational number.
Sign Gets the sign of the rational number.

Methods

Abs Returns the absolute value of a rational number.
Add Adds two rational numbers.
Ceiling Rounds a rational number up to the nearest integer.
CompareTo(BigInteger) Compares this instance to a specified rational number and returns an indication of their relative values.
CompareTo(BigRational) Compares this instance to a specified rational number and returns an indication of their relative values.
CompareTo(Int32) Compares this instance to a specified rational number and returns an indication of their relative values.
Deconstruct Deconstructs a rational number into its numerator and denominator.
Divide Divides a rational number by another and returns the result.
Equals(BigRational) Returns whether two rational numbers represent the same value.
Equals(Object) Returns a value indicating whether this instance is equal to a specified object.
(Overrides ValueType.Equals(Object))
Floor Rounds a rational number down to the nearest integer.
GetHashCode Returns the hash code for this instance.
(Overrides ValueType.GetHashCode())
GetTypeGets the Type of the current instance.
(Inherited from Object)
Max Returns the largest of two rational numbers.
Min Returns the smallest of two rational numbers.
Multiply(BigInteger, BigRational) Multiplies a rational number by an arbitrary precision integer.
Multiply(BigRational, BigInteger) Multiplies a rational number by an arbitrary precision integer.
Multiply(BigRational, BigRational) Multiplies two rational numbers.
Multiply(BigRational, Int32) Multiplies a rational number by an integer.
Multiply(Int32, BigRational) Multiplies a rational number by an integer.
Negate Negates a rational number from another and returns the result.
Pow Raises a BigRational to an integer power.
Round Rounds a rational number to the specified number of decimal digits.
Subtract Subtracts a rational number from another and returns the result.
ToString() Returns a string representation of the rational number.
(Overrides ValueType.ToString())
ToString(String, IFormatProvider) Returns a string representation of a rational number.

Operators

Addition(BigInteger, BigRational) Adds a big integer and a rational number.
Addition(BigRational, BigInteger) Adds a big integer and a rational number.
Addition(BigRational, BigRational) Adds two rational numbers.
Addition(BigRational, Int32) Adds an integer and a rational number.
Addition(Int32, BigRational) Adds an integer and a rational number.
Division(BigRational, BigInteger) Divides a rational number by an arbitrary precision integer.
Division(BigRational, BigRational) Divides a rational number by another and returns the result.
Division(BigRational, Int32) Divides a rational number by an arbitrary precision integer.
Equality(BigRational, BigInteger) Determines if a rational number is equal to another and returns the result.
Equality(BigRational, BigRational) Determines if a rational number is equal to another and returns the result.
Equality(BigRational, Int32) Determines if a rational number is equal to another and returns the result.
Explicit(BigRational to BigInteger) Converts a BigRational to a BigInteger number.
Explicit(BigRational to Byte) Converts a BigRational to a Byte value.
Explicit(BigRational to Decimal) Converts a BigRational to a Decimal number.
Explicit(BigRational to Double) Converts a BigRational to a double-precision floating-point number.
Explicit(BigRational to Int16) Converts a BigRational to a Int16 value.
Explicit(BigRational to Int32) Converts a BigRational to a Int32 value.
Explicit(BigRational to Int64) Converts a BigRational to a long integer.
Explicit(BigRational to SByte) Converts a BigRational to a SByte value.
Explicit(BigRational to Single) Converts a BigRational to a single-precision floating-point number.
Explicit(BigRational to UInt16) Converts a BigRational to a UInt16 value.
Explicit(BigRational to UInt32) Converts a BigRational to an unsigned integer.
Explicit(BigRational to UInt64) Converts a BigRational to a long unsigned integer.
Explicit(Decimal to BigRational) Converts a Decimal number to a BigInteger value.
Explicit(Double to BigRational) Converts a double-precision floating-point number to a BigInteger value.
Explicit(Single to BigRational) Converts a single-precision floating-point number to a BigInteger value.
Exponent(BigRational, Int32) Represents the exponentiation operator.
Exponentiation(BigRational, Int32) Represents the exponentiation operator.
GreaterThan(BigRational, BigInteger) Determines if a rational number is greater than another and returns the result.
GreaterThan(BigRational, BigRational) Determines if a rational number is greater than another and returns the result.
GreaterThan(BigRational, Int32) Determines if a rational number is greater than another and returns the result.
GreaterThanOrEqual(BigRational, BigInteger) Determines if a rational number is greater than or equal to another and returns the result.
GreaterThanOrEqual(BigRational, BigRational) Determines if a rational number is greater than or equal to another and returns the result.
GreaterThanOrEqual(BigRational, Int32) Determines if a rational number is greater than or equal to another and returns the result.
Implicit(BigInteger to BigRational) Converts a BigInteger value to a BigRational value.
Implicit(Byte to BigRational) Converts a Byte value to a BigRational value.
Implicit(Int16 to BigRational) Converts a 16 bit signed integer to a BigRational value.
Implicit(Int32 to BigRational) Converts a 32 bit signed integer to a BigRational value.
Implicit(Int64 to BigRational) Converts a 64 bit signed integer to a BigRational value.
Implicit(SByte to BigRational) Converts a SByte value to a BigRational value.
Implicit(UInt16 to BigRational) Converts a 16 bit unsigned integer to a BigRational value.
Implicit(UInt32 to BigRational) Converts a 32 bit unsigned integer to a BigRational value.
Implicit(UInt64 to BigRational) Converts a 64 bit unsigned integer to a BigRational value.
Inequality(BigRational, BigInteger) Determines if a rational number is not equal to another and returns the result.
Inequality(BigRational, BigRational) Determines if a rational number is not equal to another and returns the result.
Inequality(BigRational, Int32) Determines if a rational number is not equal to another and returns the result.
LessThan(BigRational, BigInteger) Determines if a rational number is less than another and returns the result.
LessThan(BigRational, BigRational) Determines if a rational number is less than another and returns the result.
LessThan(BigRational, Int32) Determines if a rational number is less than another and returns the result.
LessThanOrEqual(BigRational, BigInteger) Determines if a rational number is less than or equal to another and returns the result.
LessThanOrEqual(BigRational, BigRational) Determines if a rational number is less than or equal to another and returns the result.
LessThanOrEqual(BigRational, Int32) Determines if a rational number is less than or equal to another and returns the result.
Multiply(BigInteger, BigRational) Multiplies a rational number by an arbitrary precision integer.
Multiply(BigRational, BigInteger) Multiplies a rational number by an arbitrary precision integer.
Multiply(BigRational, BigRational) Multiplies two rational numbers.
Multiply(BigRational, Int32) Multiplies a rational number by an integer.
Multiply(Int32, BigRational) Multiplies a rational number by an integer.
Subtraction(BigInteger, BigRational) Subtracts a rational number from a big integer.
Subtraction(BigRational, BigInteger) Subtracts a big integer from a rational number.
Subtraction(BigRational, BigRational) Subtracts a rational number from another and returns the result.
Subtraction(BigRational, Int32) Subtracts an integer from a rational number.
Subtraction(Int32, BigRational) Subtracts a rational number from an integer.
UnaryNegation(BigRational) Negates a rational number from another and returns the result.

Fields

MaxValue The largest possible rational number.
MinusOne The number 1 as a rational number.
MinValue The smallest possible rational number.
One The number 1 as a rational number.
Zero The number 0 as a rational number.

See Also