bigint Struct

BigInteger convenience wrapper

DECLARATION
public struct bigint
NAMESPACE
LanguageExt

Constructors

bigint(BigInteger)
SUMMARY

Initializes a new instance of bigint structure using provided BigInteger value.

PARAMETERS
value
BigInteger
A big integer value to initialise this structure with
DECLARATION
public ctor bigint(BigInteger value)
bigint(byte)
SUMMARY

Initializes a new instance of the bigint structure using the values in a byte array.

PARAMETERS
value
byte
REMARKS
value: An array of byte values in little-endian order.

DECLARATION
public ctor bigint(byte value)
bigint(decimal)
SUMMARY

Initializes a new instance of the bigint structure using a System.Decimal value.

PARAMETERS
value
decimal
REMARKS
value: A decimal number.
DECLARATION
public ctor bigint(decimal value)
bigint(double)
SUMMARY

Initializes a new instance of the bigint structure using a double-precision floating-point value.

PARAMETERS
value
double
REMARKS
value: A double-precision floating-point value.

DECLARATION
public ctor bigint(double value)
bigint(int)
SUMMARY

Initializes a new instance of the bigint structure using a 32-bit signed integer value.

PARAMETERS
value
int
REMARKS
value: A 32-bit signed integer.
DECLARATION
public ctor bigint(int value)
bigint(long)
SUMMARY

Initializes a new instance of the bigint structure using a 64-bit signed integer value.

PARAMETERS
value
long
REMARKS
value: A 64-bit signed integer.
DECLARATION
public ctor bigint(long value)
bigint(float)
SUMMARY

Initializes a new instance of the bigint structure using a single-precision floating-point value.

PARAMETERS
value
float
REMARKS
value: A single-precision floating-point value.

DECLARATION
public ctor bigint(float value)
bigint(uint)
SUMMARY

Initializes a new instance of the bigint structure using an unsigned 32-bit integer value.

PARAMETERS
value
uint
REMARKS
value: An unsigned 32-bit integer value.
DECLARATION
public ctor bigint(uint value)
bigint(ulong)
SUMMARY

Initializes a new instance of the bigint structure with an unsigned 64-bit integer value.

PARAMETERS
value
ulong
REMARKS
value: An unsigned 64-bit integer.
DECLARATION
public ctor bigint(ulong value)

Fields

MinusOne
SUMMARY

DECLARATION
public static readonly bigint MinusOne
One
SUMMARY

DECLARATION
public static readonly bigint One
Value
DECLARATION
public readonly BigInteger Value
Zero
SUMMARY

DECLARATION
public static bigint Zero

Properties

IsEven
SUMMARY

DECLARATION
public bool IsEven { get; }
RETURNS
bool
IsOne
SUMMARY

DECLARATION
public bool IsOne { get; }
RETURNS
bool
IsPowerOfTwo
SUMMARY

DECLARATION
public bool IsPowerOfTwo { get; }
RETURNS
bool
IsZero
SUMMARY

DECLARATION
public bool IsZero { get; }
RETURNS
bool
Sign
SUMMARY

DECLARATION
public int Sign { get; }
RETURNS
int

Methods

Abs(bigint)
SUMMARY

Gets the absolute value of a bigint object.

PARAMETERS
value
bigint
REMARKS
value: A number.

DECLARATION
public static bigint Abs(bigint value)
RETURNS
bigint
The absolute value of value.
Add(bigint, bigint)
SUMMARY

Adds two bigint values and returns the result.

PARAMETERS
left
bigint
right
bigint
REMARKS
left: The first value to add.

right: The second value to add.

DECLARATION
public static bigint Add(bigint left, bigint right)
RETURNS
bigint
The sum of left and right.
Compare(bigint, bigint)
SUMMARY

Compares two bigint values and returns an integer that indicates whether the first value is less than, equal to, or greater than the second value.

PARAMETERS
left
bigint
right
bigint
REMARKS
left: The first value to compare.

right: The second value to compare.

DECLARATION
public static int Compare(bigint left, bigint right)
RETURNS
int
A signed integer that indicates the relative values of left and right, as shown in the following table.ValueConditionLess than zeroleft is less than right.Zeroleft equals right.Greater than zeroleft is greater than right.
CompareTo(long)
SUMMARY

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.

PARAMETERS
other
long
REMARKS
other: The signed 64-bit integer to compare.

DECLARATION
public int CompareTo(long other)
RETURNS
int
A signed integer value that indicates the relationship of this instance to other, as shown in the following table.Return valueDescriptionLess than zeroThe current instance is less than other.ZeroThe current instance equals other.Greater than zeroThe current instance is greater than other.
CompareTo(ulong)
SUMMARY

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.

PARAMETERS
other
ulong
REMARKS
other: The unsigned 64-bit integer to compare.

DECLARATION
public int CompareTo(ulong other)
RETURNS
int
A signed integer that indicates the relative value of this instance and other, as shown in the following table.Return valueDescriptionLess than zeroThe current instance is less than other.ZeroThe current instance equals other.Greater than zeroThe current instance is greater than other.
CompareTo(BigInteger)
SUMMARY

Compares this instance to a second bigint 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.

PARAMETERS
other
BigInteger
REMARKS
other: The object to compare.

DECLARATION
public int CompareTo(BigInteger other)
RETURNS
int
A signed integer value that indicates the relationship of this instance to other, as shown in the following table.Return valueDescriptionLess than zeroThe current instance is less than other.ZeroThe current instance equals other.Greater than zeroThe current instance is greater than other.
CompareTo(bigint)
SUMMARY

Compares this instance to a second bigint 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.

PARAMETERS
other
bigint
REMARKS
other: The object to compare.

DECLARATION
public int CompareTo(bigint other)
RETURNS
int
A signed integer value that indicates the relationship of this instance to other, as shown in the following table.Return valueDescriptionLess than zeroThe current instance is less than other.ZeroThe current instance equals other.Greater than zeroThe current instance is greater than other.
Divide(bigint, bigint)
SUMMARY

Divides one bigint value by another and returns the result.

PARAMETERS
dividend
bigint
divisor
bigint
REMARKS
dividend: The value to be divided.

divisor: The value to divide by.

DECLARATION
public static bigint Divide(bigint dividend, bigint divisor)
RETURNS
bigint
The quotient of the division.

DivRem(bigint, bigint)
SUMMARY

Divides one bigint value by another, returns the quotient and remainder.

PARAMETERS
dividend
bigint
divisor
bigint
REMARKS
dividend: The value to be divided.

divisor: The value to divide by.

DECLARATION
public static ValueTuple<bigint, bigint> DivRem(bigint dividend, bigint divisor)
RETURNS
ValueTuple<bigint, bigint>
The quotient and remainder of the division as a tuple

Equals(long)
SUMMARY

Returns a value that indicates whether the current instance and a signed 64-bit integer have the same value.

PARAMETERS
other
long
REMARKS
other: The signed 64-bit integer value to compare.

DECLARATION
public bool Equals(long other)
RETURNS
bool
true if the signed 64-bit integer and the current instance have the same value; otherwise, false.
Equals(BigInteger)
SUMMARY

Returns a value that indicates whether the current instance and a specified bigint object have the same value.

PARAMETERS
other
BigInteger
REMARKS
other: The object to compare.

DECLARATION
public bool Equals(BigInteger other)
RETURNS
bool
true if this bigint object and other have the same value; otherwise, false.
Equals(bigint)
SUMMARY

Returns a value that indicates whether the current instance and a specified bigint object have the same value.

PARAMETERS
other
bigint
REMARKS
other: The object to compare.

DECLARATION
public bool Equals(bigint other)
RETURNS
bool
true if this bigint object and other have the same value; otherwise, false.
Equals(object)
SUMMARY

Returns a value that indicates whether the current instance and a specified object have the same value.

PARAMETERS
obj
object
REMARKS
obj: The object to compare.

DECLARATION
public override bool Equals(object obj)
RETURNS
bool
true if the obj parameter is a bigint object or a type capable of implicit conversion to a bigint value, and its value is equal to the value of the current bigint object; otherwise, false.
Equals(ulong)
SUMMARY

Returns a value that indicates whether the current instance and an unsigned 64-bit integer have the same value.

PARAMETERS
other
ulong
REMARKS
other: The unsigned 64-bit integer to compare.

DECLARATION
public bool Equals(ulong other)
RETURNS
bool
true if the current instance and the unsigned 64-bit integer have the same value; otherwise, false.
GetHashCode()
SUMMARY

DECLARATION
public override int GetHashCode()
RETURNS
int
GreatestCommonDivisor(bigint, bigint)
SUMMARY

Finds the greatest common divisor of two bigint values.

PARAMETERS
left
bigint
right
bigint
REMARKS
left: The first value.

right: The second value.

DECLARATION
public static bigint GreatestCommonDivisor(bigint left, bigint right)
RETURNS
bigint
The greatest common divisor of left and right.
Log(bigint)
SUMMARY

Returns the natural (base e) logarithm of a specified number.

PARAMETERS
value
bigint
REMARKS
value: The number whose logarithm is to be found.

DECLARATION
public static double Log(bigint value)
RETURNS
double
The natural (base e) logarithm of value, as shown in the table in the Remarks section.

Log(bigint, double)
SUMMARY

Returns the logarithm of a specified number in a specified base.

PARAMETERS
value
bigint
baseValue
double
REMARKS
value: A number whose logarithm is to be found.

baseValue: The base of the logarithm.

DECLARATION
public static double Log(bigint value, double baseValue)
RETURNS
double
The base baseValue logarithm of value, as shown in the table in the Remarks section.

Log10(bigint)
SUMMARY

Returns the base 10 logarithm of a specified number.

PARAMETERS
value
bigint
REMARKS
value: A number whose logarithm is to be found.

DECLARATION
public static double Log10(bigint value)
RETURNS
double
The base 10 logarithm of value, as shown in the table in the Remarks section.

Max(bigint, bigint)
SUMMARY

Returns the larger of two bigint values.

PARAMETERS
left
bigint
right
bigint
REMARKS
left: The first value to compare.

right: The second value to compare.

DECLARATION
public static bigint Max(bigint left, bigint right)
RETURNS
bigint
The left or right parameter, whichever is larger.
Min(bigint, bigint)
SUMMARY

Returns the smaller of two bigint values.

PARAMETERS
left
bigint
right
bigint
REMARKS
left: The first value to compare.

right: The second value to compare.

DECLARATION
public static bigint Min(bigint left, bigint right)
RETURNS
bigint
The left or right parameter, whichever is smaller.
ModPow(bigint, bigint, bigint)
SUMMARY

Performs modulus division on a number raised to the power of another number.

PARAMETERS
value
bigint
exponent
bigint
modulus
bigint
REMARKS
value: The number to raise to the exponent power.

exponent: The exponent to raise value by.

modulus: The number by which to divide value raised to the exponent power.

DECLARATION
public static bigint ModPow(bigint value, bigint exponent, bigint modulus)
RETURNS
bigint
The remainder after dividing valueexponent by modulus.

Multiply(bigint, bigint)
SUMMARY

Returns the product of two bigint values.

PARAMETERS
left
bigint
right
bigint
REMARKS
left: The first number to multiply.

right: The second number to multiply.

DECLARATION
public static bigint Multiply(bigint left, bigint right)
RETURNS
bigint
The product of the left and right parameters.
Negate(bigint)
SUMMARY

Negates a specified bigint value.

PARAMETERS
value
bigint
REMARKS
value: The value to negate.

DECLARATION
public static bigint Negate(bigint value)
RETURNS
bigint
The result of the value parameter multiplied by negative one (-1).
Parse(string, NumberStyles)
SUMMARY

Converts the string representation of a number in a specified style to its bigint equivalent.

PARAMETERS
value
string
style
NumberStyles
REMARKS
value: A string that contains a number to convert.

style: A bitwise combination of the enumeration values that specify the permitted format of value.

DECLARATION
public static bigint Parse(string value, NumberStyles style)
RETURNS
bigint
A value that is equivalent to the number specified in the value parameter.

Parse(string, IFormatProvider)
SUMMARY

Converts the string representation of a number in a specified culture-specific format to its bigint equivalent.

PARAMETERS
value
string
provider
IFormatProvider
REMARKS
value: A string that contains a number to convert.

provider: An object that provides culture-specific formatting information about value.

DECLARATION
public static bigint Parse(string value, IFormatProvider provider)
RETURNS
bigint
A value that is equivalent to the number specified in the value parameter.

Parse(string)
SUMMARY

Converts the string representation of a number to its bigint equivalent.

PARAMETERS
value
string
REMARKS
value: A string that contains the number to convert.

DECLARATION
public static bigint Parse(string value)
RETURNS
bigint
A value that is equivalent to the number specified in the value parameter.

Parse(string, NumberStyles, IFormatProvider)
SUMMARY

Converts the string representation of a number in a specified style and culture-specific format to its bigint equivalent.

PARAMETERS
value
string
style
NumberStyles
provider
IFormatProvider
REMARKS
value: A string that contains a number to convert.

style: A bitwise combination of the enumeration values that specify the permitted format of value.

provider: An object that provides culture-specific formatting information about value.

DECLARATION
public static bigint Parse(string value, NumberStyles style, IFormatProvider provider)
RETURNS
bigint
A value that is equivalent to the number specified in the value parameter.

Pow(bigint, int)
SUMMARY

Raises a bigint value to the power of a specified value.

PARAMETERS
value
bigint
exponent
int
REMARKS
value: The number to raise to the exponent power.

exponent: The exponent to raise value by.

DECLARATION
public static bigint Pow(bigint value, int exponent)
RETURNS
bigint
The result of raising value to the exponent power.

Remainder(bigint, bigint)
SUMMARY

Performs integer division on two bigint values and returns the remainder.

PARAMETERS
dividend
bigint
divisor
bigint
REMARKS
dividend: The value to be divided.

divisor: The value to divide by.

DECLARATION
public static bigint Remainder(bigint dividend, bigint divisor)
RETURNS
bigint
The remainder after dividing dividend by divisor.

Subtract(bigint, bigint)
SUMMARY

Subtracts one bigint value from another and returns the result.

PARAMETERS
left
bigint
right
bigint
REMARKS
left: The value to subtract from (the minuend).

right: The value to subtract (the subtrahend).

DECLARATION
public static bigint Subtract(bigint left, bigint right)
RETURNS
bigint
The result of subtracting right from left.
ToByteArray()
SUMMARY

DECLARATION
public byte ToByteArray()
RETURNS
byte
ToString()
SUMMARY

DECLARATION
public override string ToString()
RETURNS
string
ToString(string)
SUMMARY

Converts the numeric value of the current bigint object to its equivalent string representation by using the specified format.

PARAMETERS
format
string
REMARKS
format: A standard or custom numeric format string.

DECLARATION
public string ToString(string format)
RETURNS
string
The string representation of the current bigint value in the format specified by the format parameter.

ToString(IFormatProvider)
SUMMARY

Converts the numeric value of the current bigint object to its equivalent string representation by using the specified culture-specific formatting information.

PARAMETERS
provider
IFormatProvider
REMARKS
provider: An object that supplies culture-specific formatting information.

DECLARATION
public string ToString(IFormatProvider provider)
RETURNS
string
The string representation of the current bigint value in the format specified by the provider parameter.
ToString(string, IFormatProvider)
SUMMARY

Converts the numeric value of the current bigint object to its equivalent string representation by using the specified format and culture-specific format information.

PARAMETERS
format
string
provider
IFormatProvider
REMARKS
format: A standard or custom numeric format string.

provider: An object that supplies culture-specific formatting information.

DECLARATION
public string ToString(string format, IFormatProvider provider)
RETURNS
string
The string representation of the current bigint value as specified by the format and provider parameters.

TryParse(string, NumberStyles, IFormatProvider)
SUMMARY

Tries to convert the string representation of a number in a specified style and culture-specific format to its bigint equivalent, and returns a value that indicates whether the conversion succeeded.

PARAMETERS
value
string
style
NumberStyles
provider
IFormatProvider
REMARKS
value: The string representation of a number. The string is interpreted using the style specified by style.

style: A bitwise combination of enumeration values that indicates the style elements that can be present in value. A typical value to specify is System.Globalization.NumberStyles.Integer.

provider: An object that supplies culture-specific formatting information about value.

DECLARATION
public static Option<bigint> TryParse(string value, NumberStyles style, IFormatProvider provider)
RETURNS
Option<bigint>
Optional value

TryParse(string)
SUMMARY

Tries to convert the string representation of a number to its bigint equivalent, and returns a value that indicates whether the conversion succeeded.

PARAMETERS
value
string
REMARKS
value: The string representation of a number.

DECLARATION
public static Option<bigint> TryParse(string value)
RETURNS
Option<bigint>
Optional value