Big Rational Structure
Represents an arbitrary rational number.
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.3
C#
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.3
[SerializableAttribute]
public readonly struct BigRational : IComparable,
IFormattable, IEquatable<BigRational>, IComparable<BigRational>,
IComparable<BigInteger>, IComparable<int>, INumberBase<BigRational>,
IParsable<BigRational>, ISpanFormattable, ISpanParsable<BigRational>,
IUtf8SpanFormattable, IUtf8SpanParsable<BigRational>, IAdditionOperators<BigRational, BigRational, BigRational>,
IAdditiveIdentity<BigRational, BigRational>, IDecrementOperators<BigRational>,
IDivisionOperators<BigRational, BigRational, BigRational>, IEqualityOperators<BigRational, BigRational, bool>,
IIncrementOperators<BigRational>, IMultiplicativeIdentity<BigRational, BigRational>,
IMultiplyOperators<BigRational, BigRational, BigRational>, ISubtractionOperators<BigRational, BigRational, BigRational>,
IUnaryNegationOperators<BigRational, BigRational>, IUnaryPlusOperators<BigRational, BigRational>
- Implements
- IComparable, IComparable<BigRational>, IComparable<BigInteger>, IComparable<Int32>, IEquatable<BigRational>, IFormattable, IParsable<BigRational>, ISpanFormattable, ISpanParsable<BigRational>, IUtf8SpanFormattable, IUtf8SpanParsable<BigRational>, IAdditionOperators<BigRational, BigRational, BigRational>, IAdditiveIdentity<BigRational, BigRational>, IDecrementOperators<BigRational>, IDivisionOperators<BigRational, BigRational, BigRational>, IEqualityOperators<BigRational, BigRational, Boolean>, IIncrementOperators<BigRational>, IMultiplicativeIdentity<BigRational, BigRational>, IMultiplyOperators<BigRational, BigRational, BigRational>, INumberBase<BigRational>, ISubtractionOperators<BigRational, BigRational, BigRational>, IUnaryNegationOperators<BigRational, BigRational>, IUnaryPlusOperators<BigRational, BigRational>
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
Big | Constructs a new BigInteger from two arbitrary precision integers. |
Big | Constructs a new BigRational from an arbitrary precision numerator and denominator. |
Big | 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. |
Compare | Compares this instance to a specified rational number and returns an indication of their relative values. |
Compare | Compares this instance to a specified rational number and returns an indication of their relative values. |
Compare | 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( | Returns whether two rational numbers represent the same value. |
Equals( |
Returns whether this instance is equal to a specified object.
(Overrides ValueType.Equals(Object)) |
Floor | Rounds a rational number down to the nearest integer. |
Get |
Returns the hash code for this instance.
(Overrides ValueType.GetHashCode()) |
Get | Gets the Type of the current instance. (Inherited from Object) |
IsNegative | Determines if a value represents a negative real number. |
IsPositive | Determines if a value represents zero or a positive real number. |
Max | Returns the largest of two rational numbers. |
Max | Compares two values to compute which is greater. |
Min | Returns the smallest of two rational numbers. |
Min | Compares two values to compute which is lesser. |
Multiply( | Multiplies a rational number by an arbitrary precision integer. |
Multiply( | Multiplies a rational number by an arbitrary precision integer. |
Multiply( | Multiplies two rational numbers. |
Multiply( | Multiplies a rational number by an integer. |
Multiply( | Multiplies a rational number by an integer. |
Negate | Negates a rational number from another and returns the result. |
Parse( | Parses a span of characters into a value. |
Parse( | Parses a string into a value. |
Parse( | Parses a span of characters into a value. |
Parse( | Tries to parse a string into a value. |
Pow | Raises a BigRational to an integer power. |
Reciprocal | Returns the reciprocal (inverse) of a rational number.. |
Round( | Rounds a rational number to the nearest integer. |
Round( | Rounds a rational number to the specified number of decimal digits. |
Scale | Multiplies a BigRational value by a power of two. |
Subtract | Subtracts a rational number from another and returns the result. |
ToString() |
Returns a string representation of the rational number.
(Overrides ValueType.ToString()) |
ToString( | Returns a string representation of a rational number. |
Truncate | Rounds a rational number towards zero. |
Try | Tries to format the value of the current instance into the provided span of characters. |
Try | Tries to parse a span of characters into a value. |
Try | Tries to parse a string into a value. |
Try | Tries to parse a span of characters into a value. |
Try | Tries to parse a string into a value. |
Operators
Addition( | Adds a big integer and a rational number. |
Addition( | Adds a big integer and a rational number. |
Addition( | Adds two rational numbers. |
Addition( | Adds an integer and a rational number. |
Addition( | Adds an integer and a rational number. |
Decrement( | Decrements a value. |
Division( | Divides a rational number by an arbitrary precision integer. |
Division( | Divides a rational number by another and returns the result. |
Division( | Divides a rational number by an arbitrary precision integer. |
Equality( | Determines if a rational number is equal to another and returns the result. |
Equality( | Determines if a rational number is equal to another and returns the result. |
Equality( | 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( | Represents the exponentiation operator. |
Exponentiation( | Represents the exponentiation operator. |
Greater | Determines if a rational number is greater than another and returns the result. |
Greater | Determines if a rational number is greater than another and returns the result. |
Greater | Determines if a rational number is greater than another and returns the result. |
Greater | Determines if a rational number is greater than or equal to another and returns the result. |
Greater | Determines if a rational number is greater than or equal to another and returns the result. |
Greater | 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(Int128 to BigRational) | Converts a 128 bit signed integer 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(UInt128 to BigRational) | Converts a 128 bit unsigned integer 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. |
Increment( | Increments a value. |
Inequality( | Determines if a rational number is not equal to another and returns the result. |
Inequality( | Determines if a rational number is not equal to another and returns the result. |
Inequality( | Determines if a rational number is not equal to another and returns the result. |
Less | Determines if a rational number is less than another and returns the result. |
Less | Determines if a rational number is less than another and returns the result. |
Less | Determines if a rational number is less than another and returns the result. |
Less | Determines if a rational number is less than or equal to another and returns the result. |
Less | Determines if a rational number is less than or equal to another and returns the result. |
Less | Determines if a rational number is less than or equal to another and returns the result. |
Modulus( | Returns the remainder after dividing one BigRational by another and returns the result. |
Multiply( | Multiplies a rational number by an arbitrary precision integer. |
Multiply( | Multiplies a rational number by an arbitrary precision integer. |
Multiply( | Multiplies two rational numbers. |
Multiply( | Multiplies a rational number by an integer. |
Multiply( | Multiplies a rational number by an integer. |
Subtraction( | Subtracts a rational number from a big integer. |
Subtraction( | Subtracts a big integer from a rational number. |
Subtraction( | Subtracts a rational number from another and returns the result. |
Subtraction( | Subtracts an integer from a rational number. |
Subtraction( | Subtracts a rational number from an integer. |
Unary | Negates a rational number from another and returns the result. |
Unary | Computes the unary plus of a value. |
Fields
Max | The largest possible rational number. |
Minus | The number 1 as a rational number. |
Min | The smallest possible rational number. |
One | The number 1 as a rational number. |
Zero | The number 0 as a rational number. |