Struct BigInteger
Represents an arbitrarily large signed integer.
public struct BigInteger : IComparable, IFormattable, IComparable<BigInteger>, IEquatable<BigInteger>
- Implements
- Inherited Members
Constructors
BigInteger(byte[])
Initializes a new instance of the BigInteger structure using the values in a byte array.
[CLSCompliant(false)]
public BigInteger(byte[] value)
Parameters
Exceptions
- ArgumentNullException
value
is null.
BigInteger(decimal)
Initializes a new instance of the BigInteger structure using a decimal value.
public BigInteger(decimal value)
Parameters
value
decimalA decimal number.
BigInteger(double)
Initializes a new instance of the BigInteger structure using a double-precision floating-point value.
public BigInteger(double value)
Parameters
value
doubleA double-precision floating-point value.
BigInteger(int)
Initializes a new instance of the BigInteger structure using a 32-bit signed integer value.
public BigInteger(int value)
Parameters
value
intA 32-bit signed integer.
BigInteger(long)
Initializes a new instance of the BigInteger structure using a 64-bit signed integer value.
public BigInteger(long value)
Parameters
value
longA 64-bit signed integer.
BigInteger(float)
Initializes a new instance of the BigInteger structure using a single-precision floating-point value.
public BigInteger(float value)
Parameters
value
floatA single-precision floating-point value.
BigInteger(uint)
Initializes a new instance of the BigInteger structure using an unsigned 32-bit integer value.
[CLSCompliant(false)]
public BigInteger(uint value)
Parameters
value
uintAn unsigned 32-bit integer value.
BigInteger(ulong)
Initializes a new instance of the BigInteger structure with an unsigned 64-bit integer value.
[CLSCompliant(false)]
public BigInteger(ulong value)
Parameters
value
ulongAn unsigned 64-bit integer.
Properties
BitLength
Gets number of bits used by the number.
public readonly int BitLength { get; }
Property Value
- int
The number of the bit used.
IsEven
Gets a value indicating whether the value of the current BigInteger object is an even number.
public readonly bool IsEven { get; }
Property Value
- bool
true if the value of the BigInteger object is an even number; otherwise, false.
IsOne
Gets a value indicating whether the value of the current BigInteger object is One.
public readonly bool IsOne { get; }
Property Value
- bool
true if the value of the BigInteger object is One; otherwise, false.
IsPowerOfTwo
Gets a value Indicating whether the value of the current BigInteger object is a power of two.
public readonly bool IsPowerOfTwo { get; }
Property Value
- bool
true if the value of the BigInteger object is a power of two; otherwise, false.
IsZero
Gets a value indicating whether the value of the current BigInteger object is Zero.
public readonly bool IsZero { get; }
Property Value
- bool
true if the value of the BigInteger object is Zero; otherwise, false.
MinusOne
Gets a value that represents the number negative one (-1).
public static BigInteger MinusOne { get; }
Property Value
- BigInteger
An integer whose value is negative one (-1).
One
Gets a value that represents the number one (1).
public static BigInteger One { get; }
Property Value
- BigInteger
An object whose value is one (1).
Sign
Gets a number that indicates the sign (negative, positive, or zero) of the current BigInteger object.
public readonly int Sign { get; }
Property Value
- int
A number that indicates the sign of the BigInteger object.
Zero
Gets a value that represents the number 0 (zero).
public static BigInteger Zero { get; }
Property Value
- BigInteger
An integer whose value is 0 (zero).
Methods
Abs(BigInteger)
Gets the absolute value of a BigInteger object.
public static BigInteger Abs(BigInteger value)
Parameters
value
BigIntegerA number.
Returns
- BigInteger
The absolute value of
value
.
Add(BigInteger, BigInteger)
Adds two BigInteger values and returns the result.
public static BigInteger Add(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value to add.
right
BigIntegerThe second value to add.
Returns
- BigInteger
The sum of
left
andright
.
Compare(BigInteger, BigInteger)
Compares two BigInteger values and returns an integer that indicates whether the first value is less than, equal to, or greater than the second value.
public static int Compare(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
- int
A signed integer that indicates the relative values of left and right, as shown in the following table.
Value Condition Less than zero left
is less thanright
.Zero left
equalsright
.Greater than zero left
is greater thanright
.
CompareTo(BigInteger)
Compares this instance to a second BigInteger and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.
public readonly int CompareTo(BigInteger other)
Parameters
other
BigIntegerThe object to compare.
Returns
- int
A signed integer value that indicates the relationship of this instance to
other
, as shown in the following table.Value Condition Less than zero The current instance is less than other
.Zero The current instance equals other
.Greater than zero The current instance is greater than other
.
CompareTo(long)
Compares this instance to a signed 64-bit integer and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the signed 64-bit integer.
public readonly int CompareTo(long other)
Parameters
other
longThe signed 64-bit integer to compare.
Returns
- int
A signed integer that indicates the relative value of this instance and
other
, as shown in the following table.Value Condition Less than zero The current instance is less than other
.Zero The current instance equals other
.Greater than zero The current instance is greater than other
.
CompareTo(object)
Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.
public readonly int CompareTo(object obj)
Parameters
obj
objectThe object to compare.
Returns
- int
A signed integer that indicates the relationship of the current instance to the
obj
parameter, as shown in the following table.Value Condition Less than zero The current instance is less than obj
.Zero The current instance equals obj
.Greater than zero The current instance is greater than obj
.
Exceptions
- ArgumentException
obj
is not a BigInteger.
CompareTo(ulong)
Compares this instance to an unsigned 64-bit integer and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the unsigned 64-bit integer.
[CLSCompliant(false)]
public readonly int CompareTo(ulong other)
Parameters
other
ulongThe unsigned 64-bit integer to compare.
Returns
- int
A signed integer that indicates the relative value of this instance and
other
, as shown in the following table.Value Condition Less than zero The current instance is less than other
.Zero The current instance equals other
.Greater than zero The current instance is greater than other
.
DivRem(BigInteger, BigInteger, out BigInteger)
Divides one BigInteger value by another, returns the result, and returns the remainder in an output parameter.
public static BigInteger DivRem(BigInteger dividend, BigInteger divisor, out BigInteger remainder)
Parameters
dividend
BigIntegerThe value to be divided.
divisor
BigIntegerThe value to divide by.
remainder
BigIntegerWhen this method returns, contains a BigInteger value that represents the remainder from the division. This parameter is passed uninitialized.
Returns
- BigInteger
The quotient of the division.
Divide(BigInteger, BigInteger)
Divides one BigInteger value by another and returns the result.
public static BigInteger Divide(BigInteger dividend, BigInteger divisor)
Parameters
dividend
BigIntegerThe value to be divided.
divisor
BigIntegerThe value to divide by.
Returns
- BigInteger
The quotient of the division.
Equals(BigInteger)
Returns a value that indicates whether the current instance and a specified BigInteger object have the same value.
public readonly bool Equals(BigInteger other)
Parameters
other
BigIntegerThe object to compare.
Returns
- bool
true if this BigInteger object and
other
have the same value; otherwise, false.
Equals(long)
Returns a value that indicates whether the current instance and a signed 64-bit integer have the same value.
public readonly bool Equals(long other)
Parameters
other
longThe signed 64-bit integer value to compare.
Returns
- bool
true if the signed 64-bit integer and the current instance have the same value; otherwise, false.
Equals(object)
Returns a value that indicates whether the current instance and a specified object have the same value.
public override readonly bool Equals(object obj)
Parameters
obj
objectThe object to compare.
Returns
- bool
true if the
obj
parameter is a BigInteger object or a type capable of implicit conversion to a BigInteger value, and its value is equal to the value of the current BigInteger object; otherwise, false.
Equals(ulong)
Returns a value that indicates whether the current instance and an unsigned 64-bit integer have the same value.
[CLSCompliant(false)]
public readonly bool Equals(ulong other)
Parameters
other
ulongThe unsigned 64-bit integer to compare.
Returns
- bool
true if the current instance and the unsigned 64-bit integer have the same value; otherwise, false.
GetHashCode()
Returns the hash code for the current BigInteger object.
public override readonly int GetHashCode()
Returns
- int
A 32-bit signed integer hash code.
GreatestCommonDivisor(BigInteger, BigInteger)
Finds the greatest common divisor of two BigInteger values.
public static BigInteger GreatestCommonDivisor(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value.
right
BigIntegerThe second value.
Returns
- BigInteger
The greatest common divisor of
left
andright
.
Log(BigInteger)
Returns the natural (base e
) logarithm of a specified number.
public static double Log(BigInteger value)
Parameters
value
BigIntegerThe number whose logarithm is to be found.
Returns
- double
The natural (base
e
) logarithm ofvalue
.
Exceptions
- ArgumentOutOfRangeException
The base 10 log of value is out of range of the double data type.
Log(BigInteger, double)
Returns the logarithm of a specified number in a specified base.
public static double Log(BigInteger value, double baseValue)
Parameters
value
BigIntegerA number whose logarithm is to be found.
baseValue
doubleThe base of the logarithm.
Returns
- double
The base
baseValue
logarithm of value.
Exceptions
- ArgumentOutOfRangeException
The log of
value
is out of range of the double data type.
Log10(BigInteger)
Returns the base 10 logarithm of a specified number.
public static double Log10(BigInteger value)
Parameters
value
BigIntegerA number whose logarithm is to be found.
Returns
- double
The base 10 logarithm of
value
.
Exceptions
- ArgumentOutOfRangeException
The base 10 log of value is out of range of the double data type.
Max(BigInteger, BigInteger)
Returns the larger of two BigInteger values.
public static BigInteger Max(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
- BigInteger
The
left
orright
parameter, whichever is larger.
Min(BigInteger, BigInteger)
Returns the smaller of two BigInteger values.
public static BigInteger Min(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
- BigInteger
The
left
orright
parameter, whichever is smaller.
ModInverse(BigInteger, BigInteger)
Mods the inverse.
public static BigInteger ModInverse(BigInteger bi, BigInteger modulus)
Parameters
bi
BigIntegerThe bi.
modulus
BigIntegerThe modulus.
Returns
- BigInteger
Modulus inverted number.
ModPow(BigInteger, BigInteger, BigInteger)
Performs modulus division on a number raised to the power of another number.
public static BigInteger ModPow(BigInteger value, BigInteger exponent, BigInteger modulus)
Parameters
value
BigIntegerThe number to raise to the
exponent
power.exponent
BigIntegerThe exponent to raise
value
by.modulus
BigIntegerThe number by which to divide
value
raised to theexponent
power.
Returns
- BigInteger
The remainder after dividing
value
raised byexponent
bymodulus
.
Exceptions
- ArgumentOutOfRangeException
exponent
is negative.
Multiply(BigInteger, BigInteger)
Returns the product of two BigInteger values.
public static BigInteger Multiply(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first number to multiply.
right
BigIntegerThe second number to multiply.
Returns
- BigInteger
The product of the
left
andright
parameters.
Negate(BigInteger)
Negates a specified BigInteger value.
public static BigInteger Negate(BigInteger value)
Parameters
value
BigIntegerThe value to negate.
Returns
- BigInteger
The result of the
value
parameter multiplied by negative one (-1).
Parse(string)
Converts the string representation of a number to its BigInteger equivalent.
public static BigInteger Parse(string value)
Parameters
value
stringA string that contains the number to convert.
Returns
- BigInteger
A value that is equivalent to the number specified in the
value
parameter.
Exceptions
- ArgumentNullException
value
is null.- FormatException
value
is not in the correct format.
Parse(string, NumberStyles)
Converts the string representation of a number in a specified style to its BigInteger equivalent.
public static BigInteger Parse(string value, NumberStyles style)
Parameters
value
stringA string that contains a number to convert.
style
NumberStylesA bitwise combination of the enumeration values that specify the permitted format of
value
.
Returns
- BigInteger
A value that is equivalent to the number specified in the
value
parameter.
Exceptions
- ArgumentException
style
is not a NumberStyles value.-or-
style
includes the AllowHexSpecifier or HexNumber flag along with another value.- ArgumentNullException
value
is null.- FormatException
value
does not comply with the input pattern specified by NumberStyles.
Parse(string, NumberStyles, IFormatProvider)
Converts the string representation of a number in a specified style and culture-specific format to its BigInteger equivalent.
public static BigInteger Parse(string value, NumberStyles style, IFormatProvider provider)
Parameters
value
stringA string that contains a number to convert.
style
NumberStylesA bitwise combination of the enumeration values that specify the permitted format of
value
.provider
IFormatProviderAn object that provides culture-specific formatting information about
value
.
Returns
- BigInteger
A value that is equivalent to the number specified in the
value
parameter.
Exceptions
- ArgumentException
style
is not a NumberStyles value.-or-
style
includes the AllowHexSpecifier or HexNumber flag along with another value.- ArgumentNullException
value
is null.- FormatException
value
does not comply with the input pattern specified by NumberStyles.
Parse(string, IFormatProvider)
Converts the string representation of a number in a specified style to its BigInteger equivalent.
public static BigInteger Parse(string value, IFormatProvider provider)
Parameters
value
stringA string that contains a number to convert.
provider
IFormatProviderAn object that provides culture-specific formatting information about
value
.
Returns
- BigInteger
A value that is equivalent to the number specified in the
value
parameter.
Exceptions
- ArgumentNullException
value
is null.- FormatException
value
is not in the correct format.
PositiveMod(BigInteger, BigInteger)
Returns positive remainder that results from division with two specified BigInteger values.
public static BigInteger PositiveMod(BigInteger dividend, BigInteger divisor)
Parameters
dividend
BigIntegerThe value to be divided.
divisor
BigIntegerThe value to divide by.
Returns
- BigInteger
Positive remainder that results from the division.
Pow(BigInteger, int)
Raises a BigInteger value to the power of a specified value.
public static BigInteger Pow(BigInteger value, int exponent)
Parameters
value
BigIntegerThe number to raise to the
exponent
power.exponent
intThe exponent to raise
value
by.
Returns
- BigInteger
The result of raising
value
to theexponent
power.
Random(int)
Generates a new, random BigInteger of the specified length.
public static BigInteger Random(int bitLength)
Parameters
bitLength
intThe number of bits for the new number.
Returns
- BigInteger
A random number of the specified length.
Remainder(BigInteger, BigInteger)
Performs integer division on two BigInteger values and returns the remainder.
public static BigInteger Remainder(BigInteger dividend, BigInteger divisor)
Parameters
dividend
BigIntegerThe value to be divided.
divisor
BigIntegerThe value to divide by.
Returns
- BigInteger
The remainder after dividing
dividend
bydivisor
.
Subtract(BigInteger, BigInteger)
Subtracts one BigInteger value from another and returns the result.
public static BigInteger Subtract(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe value to subtract from (the minuend).
right
BigIntegerThe value to subtract (the subtrahend).
Returns
- BigInteger
The result of subtracting
right
fromleft
.
ToByteArray()
Converts a BigInteger value to a byte array.
public readonly byte[] ToByteArray()
Returns
- byte[]
The value of the current BigInteger object converted to an array of bytes.
ToString()
Converts the numeric value of the current BigInteger object to its equivalent string representation.
public override readonly string ToString()
Returns
- string
The string representation of the current BigInteger value.
ToString(IFormatProvider)
Converts the numeric value of the current BigInteger object to its equivalent string representation by using the specified culture-specific formatting information.
public readonly string ToString(IFormatProvider provider)
Parameters
provider
IFormatProviderAn object that supplies culture-specific formatting information.
Returns
- string
The string representation of the current BigInteger value in the format specified by the
provider
parameter.
ToString(string)
Converts the numeric value of the current BigInteger object to its equivalent string representation by using the specified format.
public readonly string ToString(string format)
Parameters
format
stringA standard or custom numeric format string.
Returns
- string
The string representation of the current BigInteger value in the format specified by the
format
parameter.
Exceptions
- FormatException
format
is not a valid format string.
ToString(string, IFormatProvider)
Converts the numeric value of the current BigInteger object to its equivalent string representation by using the specified format and culture-specific format information.
public readonly string ToString(string format, IFormatProvider formatProvider)
Parameters
format
stringA standard or custom numeric format string.
formatProvider
IFormatProviderAn object that supplies culture-specific formatting information.
Returns
- string
The string representation of the current BigInteger value as specified by the
format
andformatProvider
parameters.
TryParse(string, out BigInteger)
Tries to convert the string representation of a number to its BigInteger equivalent, and returns a value that indicates whether the conversion succeeded.
public static bool TryParse(string value, out BigInteger result)
Parameters
value
stringThe string representation of a number.
result
BigIntegerWhen this method returns, contains the BigInteger equivalent to the number that is contained in value, or zero (0) if the conversion fails. The conversion fails if the
value
parameter is null or is not of the correct format. This parameter is passed uninitialized.
Returns
Exceptions
- ArgumentNullException
value
is null.
TryParse(string, NumberStyles, IFormatProvider, out BigInteger)
Tries to convert the string representation of a number in a specified style and culture-specific format to its BigInteger equivalent, and returns a value that indicates whether the conversion succeeded.
public static bool TryParse(string value, NumberStyles style, IFormatProvider provider, out BigInteger result)
Parameters
value
stringThe string representation of a number.
style
NumberStylesA bitwise combination of enumeration values that indicates the style elements that can be present in
value
.provider
IFormatProviderAn object that supplies culture-specific formatting information about
value
.result
BigIntegerWhen this method returns, contains the BigInteger equivalent to the number that is contained in value, or Zero if the conversion fails. The conversion fails if the
value
parameter is null or is not of the correct format. This parameter is passed uninitialized.
Returns
Exceptions
- ArgumentException
style
is not a NumberStyles value.-or-
style
includes the AllowHexSpecifier or HexNumber flag along with another value.
Operators
operator +(BigInteger, BigInteger)
Adds the values of two specified BigInteger objects.
public static BigInteger operator +(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value to add.
right
BigIntegerThe second value to add.
Returns
- BigInteger
The sum of
left
andright
.
operator &(BigInteger, BigInteger)
Performs a bitwise And
operation on two BigInteger values.
public static BigInteger operator &(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value.
right
BigIntegerThe second value.
Returns
- BigInteger
The result of the bitwise
And
operation.
operator |(BigInteger, BigInteger)
Performs a bitwise Or
operation on two BigInteger values.
public static BigInteger operator |(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value.
right
BigIntegerThe second value.
Returns
- BigInteger
The result of the bitwise
Or
operation.
operator --(BigInteger)
Decrements a BigInteger value by 1.
public static BigInteger operator --(BigInteger value)
Parameters
value
BigIntegerThe value to decrement.
Returns
- BigInteger
The value of the
value
parameter decremented by 1.
operator /(BigInteger, BigInteger)
Divides a specified BigInteger value by another specified BigInteger value by using integer division.
public static BigInteger operator /(BigInteger dividend, BigInteger divisor)
Parameters
dividend
BigIntegerThe value to be divided.
divisor
BigIntegerThe value to divide by.
Returns
- BigInteger
The integral result of the division.
operator ==(BigInteger, BigInteger)
Returns a value that indicates whether the values of two BigInteger objects are equal.
public static bool operator ==(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator ==(BigInteger, long)
Returns a value that indicates whether a BigInteger value and a signed long integer value are equal.
public static bool operator ==(BigInteger left, long right)
Parameters
left
BigIntegerThe first value to compare.
right
longThe second value to compare.
Returns
operator ==(BigInteger, ulong)
Returns a value that indicates whether a BigInteger value and an unsigned long integer value are equal.
[CLSCompliant(false)]
public static bool operator ==(BigInteger left, ulong right)
Parameters
left
BigIntegerThe first value to compare.
right
ulongThe second value to compare.
Returns
operator ==(long, BigInteger)
Returns a value that indicates whether a signed long integer value and a BigInteger value are equal.
public static bool operator ==(long left, BigInteger right)
Parameters
left
longThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator ==(ulong, BigInteger)
Returns a value that indicates whether an unsigned long integer value and a BigInteger value are equal.
[CLSCompliant(false)]
public static bool operator ==(ulong left, BigInteger right)
Parameters
left
ulongThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator ^(BigInteger, BigInteger)
Performs a bitwise exclusive Or
(XOr
) operation on two BigInteger values.
public static BigInteger operator ^(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value.
right
BigIntegerThe second value.
Returns
- BigInteger
The result of the bitwise
Or
operation.
explicit operator byte(BigInteger)
Defines an explicit conversion of a BigInteger object to an unsigned byte value.
public static explicit operator byte(BigInteger value)
Parameters
value
BigIntegerThe value to convert to a byte.
Returns
- byte
An object that contains the value of the
value
parameter.
explicit operator decimal(BigInteger)
Defines an explicit conversion of a BigInteger object to a decimal value.
public static explicit operator decimal(BigInteger value)
Parameters
value
BigIntegerThe value to convert to a decimal.
Returns
- decimal
An object that contains the value of the
value
parameter.
explicit operator double(BigInteger)
Defines an explicit conversion of a BigInteger object to a double value.
public static explicit operator double(BigInteger value)
Parameters
value
BigIntegerThe value to convert to a double.
Returns
- double
An object that contains the value of the
value
parameter.
explicit operator short(BigInteger)
Defines an explicit conversion of a BigInteger object to a 16-bit signed integer value.
public static explicit operator short(BigInteger value)
Parameters
value
BigIntegerThe value to convert to a 16-bit signed integer.
Returns
- short
An object that contains the value of the
value
parameter.
explicit operator int(BigInteger)
Defines an explicit conversion of a BigInteger object to a 32-bit signed integer value.
public static explicit operator int(BigInteger value)
Parameters
value
BigIntegerThe value to convert to a 32-bit signed integer.
Returns
- int
An object that contains the value of the
value
parameter.
explicit operator long(BigInteger)
Defines an explicit conversion of a BigInteger object to a 64-bit signed integer value.
public static explicit operator long(BigInteger value)
Parameters
value
BigIntegerThe value to convert to a 64-bit signed integer.
Returns
- long
An object that contains the value of the
value
parameter.
explicit operator sbyte(BigInteger)
Defines an explicit conversion of a BigInteger object to a signed 8-bit value.
[CLSCompliant(false)]
public static explicit operator sbyte(BigInteger value)
Parameters
value
BigIntegerThe value to convert to a signed 8-bit value.
Returns
- sbyte
An object that contains the value of the
value
parameter.
explicit operator float(BigInteger)
Defines an explicit conversion of a BigInteger object to a single-precision floating-point value.
public static explicit operator float(BigInteger value)
Parameters
value
BigIntegerThe value to convert to a single-precision floating-point value.
Returns
- float
An object that contains the value of the
value
parameter.
explicit operator ushort(BigInteger)
Defines an explicit conversion of a BigInteger object to a 16-bit unsigned integer value.
[CLSCompliant(false)]
public static explicit operator ushort(BigInteger value)
Parameters
value
BigIntegerThe value to convert to a 16-bit unsigned integer.
Returns
- ushort
An object that contains the value of the
value
parameter.
explicit operator uint(BigInteger)
Defines an explicit conversion of a BigInteger object to an unsigned 32-bit integer value.
[CLSCompliant(false)]
public static explicit operator uint(BigInteger value)
Parameters
value
BigIntegerThe value to convert to an unsigned 32-bit integer.
Returns
- uint
An object that contains the value of the
value
parameter.
explicit operator ulong(BigInteger)
Defines an explicit conversion of a BigInteger object to an unsigned 64-bit integer value.
[CLSCompliant(false)]
public static explicit operator ulong(BigInteger value)
Parameters
value
BigIntegerThe value to convert to an unsigned 64-bit integer.
Returns
- ulong
An object that contains the value of the
value
parameter.
explicit operator BigInteger(decimal)
Defines an explicit conversion of a decimal object to a BigInteger value.
public static explicit operator BigInteger(decimal value)
Parameters
value
decimalThe value to convert to a BigInteger.
Returns
- BigInteger
An object that contains the value of the
value
parameter.
explicit operator BigInteger(double)
Defines an explicit conversion of a double value to a BigInteger value.
public static explicit operator BigInteger(double value)
Parameters
value
doubleThe value to convert to a BigInteger.
Returns
- BigInteger
An object that contains the value of the
value
parameter.
explicit operator BigInteger(float)
Defines an explicit conversion of a float object to a BigInteger value.
public static explicit operator BigInteger(float value)
Parameters
value
floatThe value to convert to a BigInteger.
Returns
- BigInteger
An object that contains the value of the
value
parameter.
operator >(BigInteger, BigInteger)
Returns a value that indicates whether a BigInteger value is greater than another BigInteger value.
public static bool operator >(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator >(BigInteger, long)
Returns a value that indicates whether a BigInteger is greater than a 64-bit signed integer value.
public static bool operator >(BigInteger left, long right)
Parameters
left
BigIntegerThe first value to compare.
right
longThe second value to compare.
Returns
operator >(BigInteger, ulong)
Returns a value that indicates whether a BigInteger value is greater than a 64-bit unsigned integer.
[CLSCompliant(false)]
public static bool operator >(BigInteger left, ulong right)
Parameters
left
BigIntegerThe first value to compare.
right
ulongThe second value to compare.
Returns
operator >(long, BigInteger)
Returns a value that indicates whether a 64-bit signed integer is greater than a BigInteger value.
public static bool operator >(long left, BigInteger right)
Parameters
left
longThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator >(ulong, BigInteger)
Returns a value that indicates whether a 64-bit unsigned integer is greater than a BigInteger value.
[CLSCompliant(false)]
public static bool operator >(ulong left, BigInteger right)
Parameters
left
ulongThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator >=(BigInteger, BigInteger)
Returns a value that indicates whether a BigInteger value is greater than or equal to another BigInteger value.
public static bool operator >=(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator >=(BigInteger, long)
Returns a value that indicates whether a BigInteger value is greater than or equal to a 64-bit signed integer value.
public static bool operator >=(BigInteger left, long right)
Parameters
left
BigIntegerThe first value to compare.
right
longThe second value to compare.
Returns
operator >=(BigInteger, ulong)
Returns a value that indicates whether a BigInteger value is greater than or equal to a 64-bit unsigned integer value.
[CLSCompliant(false)]
public static bool operator >=(BigInteger left, ulong right)
Parameters
left
BigIntegerThe first value to compare.
right
ulongThe second value to compare.
Returns
operator >=(long, BigInteger)
Returns a value that indicates whether a 64-bit signed integer is greater than or equal to a BigInteger value.
public static bool operator >=(long left, BigInteger right)
Parameters
left
longThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator >=(ulong, BigInteger)
Returns a value that indicates whether a 64-bit unsigned integer is greater than or equal to a BigInteger value.
[CLSCompliant(false)]
public static bool operator >=(ulong left, BigInteger right)
Parameters
left
ulongThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
implicit operator BigInteger(byte)
Defines an implicit conversion of an unsigned byte to a BigInteger value.
public static implicit operator BigInteger(byte value)
Parameters
value
byteThe value to convert to a BigInteger.
Returns
- BigInteger
An object that contains the value of the
value
parameter.
implicit operator BigInteger(short)
Defines an implicit conversion of a signed 16-bit integer to a BigInteger value.
public static implicit operator BigInteger(short value)
Parameters
value
shortThe value to convert to a BigInteger.
Returns
- BigInteger
An object that contains the value of the
value
parameter.
implicit operator BigInteger(int)
Defines an implicit conversion of a signed 32-bit integer to a BigInteger value.
public static implicit operator BigInteger(int value)
Parameters
value
intThe value to convert to a BigInteger.
Returns
- BigInteger
An object that contains the value of the
value
parameter.
implicit operator BigInteger(long)
Defines an implicit conversion of a signed 64-bit integer to a BigInteger value.
public static implicit operator BigInteger(long value)
Parameters
value
longThe value to convert to a BigInteger.
Returns
- BigInteger
An object that contains the value of the
value
parameter.
implicit operator BigInteger(sbyte)
Defines an implicit conversion of a signed byte to a BigInteger value.
[CLSCompliant(false)]
public static implicit operator BigInteger(sbyte value)
Parameters
value
sbyteThe value to convert to a BigInteger.
Returns
- BigInteger
An object that contains the value of the
value
parameter.
implicit operator BigInteger(ushort)
Defines an implicit conversion of a 16-bit unsigned integer to a BigInteger value.
[CLSCompliant(false)]
public static implicit operator BigInteger(ushort value)
Parameters
value
ushortThe value to convert to a BigInteger.
Returns
- BigInteger
An object that contains the value of the
value
parameter.
implicit operator BigInteger(uint)
Defines an implicit conversion of a 32-bit unsigned integer to a BigInteger value.
[CLSCompliant(false)]
public static implicit operator BigInteger(uint value)
Parameters
value
uintThe value to convert to a BigInteger.
Returns
- BigInteger
An object that contains the value of the
value
parameter.
implicit operator BigInteger(ulong)
Defines an implicit conversion of a 64-bit unsigned integer to a BigInteger value.
[CLSCompliant(false)]
public static implicit operator BigInteger(ulong value)
Parameters
value
ulongThe value to convert to a BigInteger.
Returns
- BigInteger
An object that contains the value of the
value
parameter.
operator ++(BigInteger)
Increments a BigInteger value by 1.
public static BigInteger operator ++(BigInteger value)
Parameters
value
BigIntegerThe value to increment.
Returns
- BigInteger
The value of the
value
parameter incremented by 1.
operator !=(BigInteger, BigInteger)
Returns a value that indicates whether two BigInteger objects have different values.
public static bool operator !=(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator !=(BigInteger, long)
Returns a value that indicates whether a BigInteger value and a 64-bit signed integer are not equal.
public static bool operator !=(BigInteger left, long right)
Parameters
left
BigIntegerThe first value to compare.
right
longThe second value to compare.
Returns
operator !=(BigInteger, ulong)
Returns a value that indicates whether a BigInteger value and a 64-bit unsigned integer are not equal.
[CLSCompliant(false)]
public static bool operator !=(BigInteger left, ulong right)
Parameters
left
BigIntegerThe first value to compare.
right
ulongThe second value to compare.
Returns
operator !=(long, BigInteger)
Returns a value that indicates whether a 64-bit signed integer and a BigInteger value are not equal.
public static bool operator !=(long left, BigInteger right)
Parameters
left
longThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator !=(ulong, BigInteger)
Returns a value that indicates whether a 64-bit unsigned integer and a BigInteger value are not equal.
[CLSCompliant(false)]
public static bool operator !=(ulong left, BigInteger right)
Parameters
left
ulongThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator <<(BigInteger, int)
Shifts a BigInteger value a specified number of bits to the left.
public static BigInteger operator <<(BigInteger value, int shift)
Parameters
value
BigIntegerThe value whose bits are to be shifted.
shift
intThe number of bits to shift value to the left.
Returns
- BigInteger
A value that has been shifted to the left by the specified number of bits.
operator <(BigInteger, BigInteger)
Returns a value that indicates whether a BigInteger value is less than another BigInteger value.
public static bool operator <(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator <(BigInteger, long)
Returns a value that indicates whether a BigInteger value is less than a 64-bit signed integer.
public static bool operator <(BigInteger left, long right)
Parameters
left
BigIntegerThe first value to compare.
right
longThe second value to compare.
Returns
operator <(BigInteger, ulong)
Returns a value that indicates whether a 64-bit signed integer is less than a BigInteger value.
[CLSCompliant(false)]
public static bool operator <(BigInteger left, ulong right)
Parameters
left
BigIntegerThe first value to compare.
right
ulongThe second value to compare.
Returns
operator <(long, BigInteger)
Returns a value that indicates whether a 64-bit signed integer is less than a BigInteger value.
public static bool operator <(long left, BigInteger right)
Parameters
left
longThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator <(ulong, BigInteger)
Returns a value that indicates whether a 64-bit unsigned integer is less than a BigInteger value.
[CLSCompliant(false)]
public static bool operator <(ulong left, BigInteger right)
Parameters
left
ulongThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator <=(BigInteger, BigInteger)
Returns a value that indicates whether a BigInteger value is less than or equal to another BigInteger value.
public static bool operator <=(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator <=(BigInteger, long)
Returns a value that indicates whether a BigInteger value is less than or equal to a 64-bit signed integer.
public static bool operator <=(BigInteger left, long right)
Parameters
left
BigIntegerThe first value to compare.
right
longThe second value to compare.
Returns
operator <=(BigInteger, ulong)
Returns a value that indicates whether a BigInteger value is less than or equal to a 64-bit unsigned integer.
[CLSCompliant(false)]
public static bool operator <=(BigInteger left, ulong right)
Parameters
left
BigIntegerThe first value to compare.
right
ulongThe second value to compare.
Returns
operator <=(long, BigInteger)
Returns a value that indicates whether a 64-bit signed integer is less than or equal to a BigInteger value.
public static bool operator <=(long left, BigInteger right)
Parameters
left
longThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator <=(ulong, BigInteger)
Returns a value that indicates whether a 64-bit unsigned integer is less than or equal to a BigInteger value.
[CLSCompliant(false)]
public static bool operator <=(ulong left, BigInteger right)
Parameters
left
ulongThe first value to compare.
right
BigIntegerThe second value to compare.
Returns
operator %(BigInteger, BigInteger)
Returns the remainder that results from division with two specified BigInteger values.
public static BigInteger operator %(BigInteger dividend, BigInteger divisor)
Parameters
dividend
BigIntegerThe value to be divided.
divisor
BigIntegerThe value to divide by.
Returns
- BigInteger
The remainder that results from the division.
operator *(BigInteger, BigInteger)
Multiplies two specified BigInteger values.
public static BigInteger operator *(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe first value to multiply.
right
BigIntegerThe second value to multiply.
Returns
- BigInteger
The product of left and right.
operator ~(BigInteger)
Returns the bitwise one's complement of a BigInteger value.
public static BigInteger operator ~(BigInteger value)
Parameters
value
BigIntegerAn integer value.
Returns
- BigInteger
The bitwise one's complement of
value
.
operator >>(BigInteger, int)
Shifts a BigInteger value a specified number of bits to the right.
public static BigInteger operator >>(BigInteger value, int shift)
Parameters
value
BigIntegerThe value whose bits are to be shifted.
shift
intThe number of bits to shift value to the right.
Returns
- BigInteger
A value that has been shifted to the right by the specified number of bits.
operator -(BigInteger, BigInteger)
Subtracts a BigInteger value from another BigInteger value.
public static BigInteger operator -(BigInteger left, BigInteger right)
Parameters
left
BigIntegerThe value to subtract from (the minuend).
right
BigIntegerThe value to subtract (the subtrahend).
Returns
- BigInteger
The result of subtracting
right
fromleft
.
operator -(BigInteger)
Negates a specified BigInteger value.
public static BigInteger operator -(BigInteger value)
Parameters
value
BigIntegerThe value to negate.
Returns
- BigInteger
The result of the
value
parameter multiplied by negative one (-1).
operator +(BigInteger)
Returns the value of the BigInteger operand.
public static BigInteger operator +(BigInteger value)
Parameters
value
BigIntegerAn integer value.
Returns
- BigInteger
The value of the
value
operand.
Remarks
The sign of the operand is unchanged.