PeterO.Numbers.EInteger
## PeterO.Numbers.EInteger
public sealed class EInteger : System.IComparable, System.IEquatable
Represents an arbitrary-precision integer. (The “E” stands for “extended”, and has this prefix to group it with the other classes common to this library, particularly EDecimal, EFloat, and ERational.) Instances of this class are immutable, so they are inherently safe for use by multiple threads. Multiple instances of this object with the same value are interchangeable, but they should be compared using the “Equals” method rather than the “==” operator.
Security note
It is not recommended to implement security-sensitive algorithms using the methods in this class, for several reasons:
-
EInteger
objects are immutable, so they can’t be modified, and the memory they occupy is not guaranteed to be cleared in a timely fashion due to garbage collection. This is relevant for applications that use many-bit-long numbers as secret parameters. -
The methods in this class (especially those that involve arithmetic) are not guaranteed to be “constant-time” (nondata-dependent) for all relevant inputs. Certain attacks that involve encrypted communications have exploited the timing and other aspects of such communications to derive keying material or cleartext indirectly.
Applications should instead use dedicated security libraries to handle big numbers in security-sensitive algorithms.
Member Summary
[Abs()](#Abs)
- Returns the absolute value of this object’s value.[Add(int)](#Add_int)
- Adds this arbitrary-precision integer and a 32-bit signed integer and returns the result.[Add(long)](#Add_long)
- Adds this arbitrary-precision integer and a 64-bit signed integer and returns the result.[Add(PeterO.Numbers.EInteger)](#Add_PeterO_Numbers_EInteger)
- Adds this arbitrary-precision integer and another arbitrary-precision integer and returns the result.[And(PeterO.Numbers.EInteger)](#And_PeterO_Numbers_EInteger)
- Does an AND operation between this arbitrary-precision integer and another one.[And(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#And_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger)
- Does an AND operation between two arbitrary-precision integer values.[AndNot(PeterO.Numbers.EInteger)](#AndNot_PeterO_Numbers_EInteger)
- Does an AND NOT operation between this arbitrary-precision integer and another one.[AsInt32Checked()](#AsInt32Checked)
- Obsolete: Renamed to ToInt32Checked.[AsInt32Unchecked()](#AsInt32Unchecked)
- Obsolete: Renamed to ToInt32Unchecked.[AsInt64Checked()](#AsInt64Checked)
- Obsolete: Renamed to ToInt64Checked.[AsInt64Unchecked()](#AsInt64Unchecked)
- Obsolete: Renamed to ToInt64Unchecked.[CanFitInInt32()](#CanFitInInt32)
- Returns whether this object’s value can fit in a 32-bit signed integer.[CanFitInInt64()](#CanFitInInt64)
- Returns whether this object’s value can fit in a 64-bit signed integer.[CompareTo(int)](#CompareTo_int)
- Compares an arbitrary-precision integer with this instance.[CompareTo(long)](#CompareTo_long)
- Compares an arbitrary-precision integer with this instance.[CompareTo(PeterO.Numbers.EInteger)](#CompareTo_PeterO_Numbers_EInteger)
- Compares an arbitrary-precision integer with this instance.[Decrement()](#Decrement)
- Returns one subtracted from this arbitrary-precision integer.[Divide(int)](#Divide_int)
- Divides this arbitrary-precision integer by a 32-bit signed integer and returns the result.[Divide(long)](#Divide_long)
- Divides this arbitrary-precision integer by a 64-bit signed integer and returns the result.[Divide(PeterO.Numbers.EInteger)](#Divide_PeterO_Numbers_EInteger)
- Divides this arbitrary-precision integer by another arbitrary-precision integer and returns the result.[DivRem(int)](#DivRem_int)
- Divides this arbitrary-precision integer by a 32-bit signed integer and returns a two-item array containing the result of the division and the remainder, in that order.[DivRem(long)](#DivRem_long)
- Divides this arbitrary-precision integer by a 64-bit signed integer and returns a two-item array containing the result of the division and the remainder, in that order.[DivRem(PeterO.Numbers.EInteger)](#DivRem_PeterO_Numbers_EInteger)
- Divides this arbitrary-precision integer by another arbitrary-precision integer and returns a two-item array containing the result of the division and the remainder, in that order.[DivRem(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger, PeterO.Numbers.EInteger&)](#DivRem_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger)
- Obsolete: Use the DivRem instance method instead.[Equals(object)](#Equals_object)
- Determines whether this object and another object are equal and have the same type.[Equals(PeterO.Numbers.EInteger)](#Equals_PeterO_Numbers_EInteger)
- Determines whether this object and another object are equal.[Eqv(PeterO.Numbers.EInteger)](#Eqv_PeterO_Numbers_EInteger)
- Does an XOR NOT operation (or equivalence operation, EQV operation, or exclusive-OR NOT operation) between this arbitrary-precision integer and another one.[explicit operator byte(PeterO.Numbers.EInteger)](#explicit_operator_byte_PeterO_Numbers_EInteger)
- Converts an arbitrary-precision integer to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255).[explicit operator int(PeterO.Numbers.EInteger)](#explicit_operator_int_PeterO_Numbers_EInteger)
- Converts an arbitrary-precision integer to a 32-bit signed integer if it can fit in a 32-bit signed integer.[explicit operator long(PeterO.Numbers.EInteger)](#explicit_operator_long_PeterO_Numbers_EInteger)
- Converts an arbitrary-precision integer to a 64-bit signed integer if it can fit in a 64-bit signed integer.[explicit operator PeterO.Numbers.EInteger(bool)](#explicit_operator_PeterO_Numbers_EInteger_bool)
- Converts a byte (from 0 to 255) to an arbitrary-precision integer.[explicit operator sbyte(PeterO.Numbers.EInteger)](#explicit_operator_sbyte_PeterO_Numbers_EInteger)
- Converts an arbitrary-precision integer to an 8-bit signed integer if it can fit in an 8-bit signed integer.[explicit operator short(PeterO.Numbers.EInteger)](#explicit_operator_short_PeterO_Numbers_EInteger)
- Converts an arbitrary-precision integer to a 16-bit signed integer if it can fit in a 16-bit signed integer.[explicit operator uint(PeterO.Numbers.EInteger)](#explicit_operator_uint_PeterO_Numbers_EInteger)
- Converts an arbitrary-precision integer to a 32-bit signed integer if it can fit in a 32-bit signed integer.[explicit operator ulong(PeterO.Numbers.EInteger)](#explicit_operator_ulong_PeterO_Numbers_EInteger)
- Converts an arbitrary-precision integer to a 64-bit unsigned integer if it can fit in a 64-bit unsigned integer.[explicit operator ushort(PeterO.Numbers.EInteger)](#explicit_operator_ushort_PeterO_Numbers_EInteger)
- Converts an arbitrary-precision integer to a 16-bit unsigned integer if it can fit in a 16-bit unsigned integer.[FromBoolean(bool)](#FromBoolean_bool)
- Converts a Boolean value (true or false) to an arbitrary-precision integer.[FromByte(byte)](#FromByte_byte)
- Converts a byte (from 0 to 255) to an arbitrary-precision integer.[FromBytes(byte[], bool)](#FromBytes_byte_bool)
- Initializes an arbitrary-precision integer from an array of bytes.[FromBytes(byte[], int, int, bool)](#FromBytes_byte_int_int_bool)
- Initializes an arbitrary-precision integer from a portion of an array of bytes.[FromInt16(short)](#FromInt16_short)
- Converts a 16-bit signed integer to an arbitrary-precision integer.[FromInt32(int)](#FromInt32_int)
- Converts a 32-bit signed integer to an arbitrary-precision integer.[FromInt64(long)](#FromInt64_long)
- Converts a 64-bit signed integer to an arbitrary-precision integer.[FromInt64AsUnsigned(long)](#FromInt64AsUnsigned_long)
- Converts an unsigned integer expressed as a 64-bit signed integer to an arbitrary-precision integer.[FromRadixString(byte[], int)](#FromRadixString_byte_int)
- Converts a sequence of bytes (interpreted as text) to an arbitrary-precision integer in a given radix.[FromRadixString(char[], int)](#FromRadixString_char_int)
- Converts a sequence of char s to an arbitrary-precision integer in a given radix.[FromRadixString(string, int)](#FromRadixString_string_int)
- Converts a string to an arbitrary-precision integer in a given radix.[FromRadixSubstring(byte[], int, int, int)](#FromRadixSubstring_byte_int_int_int)
- Converts a portion of a sequence of bytes (interpreted as text) to an arbitrary-precision integer in a given radix.[FromRadixSubstring(char[], int, int, int)](#FromRadixSubstring_char_int_int_int)
- Converts a portion of a sequence of char s to an arbitrary-precision integer in a given radix.[FromRadixSubstring(string, int, int, int)](#FromRadixSubstring_string_int_int_int)
- Converts a portion of a string to an arbitrary-precision integer in a given radix.[FromSByte(sbyte)](#FromSByte_sbyte)
- Converts an 8-bit signed integer to an arbitrary-precision integer.[FromString(byte[])](#FromString_byte)
- Converts a sequence of bytes (interpreted as text) to an arbitrary-precision integer.[FromString(char[])](#FromString_char)
- Converts a sequence of char s to an arbitrary-precision integer.[FromString(string)](#FromString_string)
- Converts a string to an arbitrary-precision integer.[FromSubstring(byte[], int, int)](#FromSubstring_byte_int_int)
- Converts a portion of a sequence of bytes (interpreted as text) to an arbitrary-precision integer.[FromSubstring(char[], int, int)](#FromSubstring_char_int_int)
- Converts a portion of a sequence of char s to an arbitrary-precision integer.[FromSubstring(string, int, int)](#FromSubstring_string_int_int)
- Converts a portion of a string to an arbitrary-precision integer.[FromUInt16(ushort)](#FromUInt16_ushort)
- Converts a 16-bit unsigned integer to an arbitrary-precision integer.[FromUInt32(uint)](#FromUInt32_uint)
- Converts a 32-bit signed integer to an arbitrary-precision integer.[FromUInt64(ulong)](#FromUInt64_ulong)
- Converts a 64-bit unsigned integer to an arbitrary-precision integer.[Gcd(PeterO.Numbers.EInteger)](#Gcd_PeterO_Numbers_EInteger)
- Returns the greatest common divisor of this integer and the specified integer.[GetBits(int, int)](#GetBits_int_int)
- Retrieves bits from this integer’s two’s-complement form.[GetDigitCount()](#GetDigitCount)
- Obsolete: This method may overflow. Use GetDigitCountAsEInteger instead.[GetDigitCountAsEInteger()](#GetDigitCountAsEInteger)
- Returns the number of decimal digits used by this integer, in the form of an arbitrary-precision integer.[GetDigitCountAsInt64()](#GetDigitCountAsInt64)
- Returns the number of decimal digits used by this integer, in the form of a 64-bit signed integer.[GetHashCode()](#GetHashCode)
- Returns the hash code for this instance.[GetLowBit()](#GetLowBit)
- Obsolete: This method may overflow. Use GetLowBitAsEInteger instead.[GetLowBitAsEInteger()](#GetLowBitAsEInteger)
- Gets the bit position of the lowest set bit in this number’s absolute value, in the form of an arbitrary-precision integer.[GetLowBitAsInt64()](#GetLowBitAsInt64)
- Gets the bit position of the lowest set bit in this number’s absolute value, in the form of a 64-bit signed integer.[GetSignedBit(int)](#GetSignedBit_int)
- Returns whether a bit is set in the two’s-complement form (see T:PeterO.[GetSignedBit(PeterO.Numbers.EInteger)](#GetSignedBit_PeterO_Numbers_EInteger)
- Returns whether a bit is set in the two’s-complement form (see T:PeterO.[GetSignedBitLength()](#GetSignedBitLength)
- Obsolete: This method may overflow. Use GetSignedBitLengthAsEInteger instead.[GetSignedBitLengthAsEInteger()](#GetSignedBitLengthAsEInteger)
- Finds the minimum number of bits needed to represent this object’s value, except for its sign, and returns that number of bits as an arbitrary-precision integer.[GetSignedBitLengthAsInt64()](#GetSignedBitLengthAsInt64)
- Finds the minimum number of bits needed to represent this object’s value, except for its sign, and returns that number of bits as a 64-bit signed integer.[GetUnsignedBit(int)](#GetUnsignedBit_int)
- Returns whether a bit is set in this number’s absolute value.[GetUnsignedBit(PeterO.Numbers.EInteger)](#GetUnsignedBit_PeterO_Numbers_EInteger)
- Returns whether a bit is set in this number’s absolute value.[GetUnsignedBitLength()](#GetUnsignedBitLength)
- Obsolete: This method may overflow. Use GetUnsignedBitLengthAsEInteger instead.[GetUnsignedBitLengthAsEInteger()](#GetUnsignedBitLengthAsEInteger)
- Finds the minimum number of bits needed to represent this number’s absolute value, and returns that number of bits as an arbitrary-precision integer.[GetUnsignedBitLengthAsInt64()](#GetUnsignedBitLengthAsInt64)
- Finds the minimum number of bits needed to represent this number’s absolute value, and returns that number of bits as a 64-bit signed integer.[Imp(PeterO.Numbers.EInteger)](#Imp_PeterO_Numbers_EInteger)
- Obsolete: Does the incorrect implication operation. Use Imply instead.[implicit operator PeterO.Numbers.EInteger(byte)](#implicit_operator_PeterO_Numbers_EInteger_byte)
- Converts a byte (from 0 to 255) to an arbitrary-precision integer.[implicit operator PeterO.Numbers.EInteger(int)](#implicit_operator_PeterO_Numbers_EInteger_int)
- Converts a 32-bit signed integer to an arbitrary-precision integer.[implicit operator PeterO.Numbers.EInteger(long)](#implicit_operator_PeterO_Numbers_EInteger_long)
- Converts a 64-bit signed integer to an arbitrary-precision integer.[implicit operator PeterO.Numbers.EInteger(sbyte)](#implicit_operator_PeterO_Numbers_EInteger_sbyte)
- Converts an 8-bit signed integer to an arbitrary-precision integer.[implicit operator PeterO.Numbers.EInteger(short)](#implicit_operator_PeterO_Numbers_EInteger_short)
- Converts a 16-bit signed integer to an arbitrary-precision integer.[implicit operator PeterO.Numbers.EInteger(uint)](#implicit_operator_PeterO_Numbers_EInteger_uint)
- Converts a 32-bit signed integer to an arbitrary-precision integer.[implicit operator PeterO.Numbers.EInteger(ulong)](#implicit_operator_PeterO_Numbers_EInteger_ulong)
- Converts a 64-bit unsigned integer to an arbitrary-precision integer.[implicit operator PeterO.Numbers.EInteger(ushort)](#implicit_operator_PeterO_Numbers_EInteger_ushort)
- Converts a 16-bit unsigned integer to an arbitrary-precision integer.[Increment()](#Increment)
- Returns one added to this arbitrary-precision integer.[IsEven](#IsEven)
- Gets a value indicating whether this value is even.[IsPowerOfTwo](#IsPowerOfTwo)
- Gets a value indicating whether this object’s value is a power of two, and greater than 0.[IsZero](#IsZero)
- Gets a value indicating whether this value is 0.[LowBits(int)](#LowBits_int)
- Extracts the lowest bits of this integer.[LowBits(long)](#LowBits_long)
- Extracts the lowest bits of this integer.[LowBits(PeterO.Numbers.EInteger)](#LowBits_PeterO_Numbers_EInteger)
- Extracts the lowest bits of this integer.[Max(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#Max_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger)
- Returns the greater of two arbitrary-precision integers.[MaxMagnitude(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#MaxMagnitude_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger)
- Of two arbitrary-precision integers, returns the one with the greater absolute value.[Min(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#Min_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger)
- Returns the smaller of two arbitrary-precision integers.[MinMagnitude(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#MinMagnitude_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger)
- Of two arbitrary-precision integers, returns the one with the smaller absolute value.[Mod(int)](#Mod_int)
- Finds the modulus remainder that results when this instance is divided by the value of another integer.[Mod(PeterO.Numbers.EInteger)](#Mod_PeterO_Numbers_EInteger)
- Finds the modulus remainder that results when this instance is divided by the value of an arbitrary-precision integer.[ModPow(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#ModPow_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger)
- Calculates the remainder when this arbitrary-precision integer raised to a certain power is divided by another arbitrary-precision integer.[ModPow(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#ModPow_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger)
- Calculates the remainder when an arbitrary-precision integer raised to a certain power is divided by another arbitrary-precision integer.[Multiply(int)](#Multiply_int)
- Multiplies this arbitrary-precision integer by a 32-bit signed integer and returns the result.[Multiply(long)](#Multiply_long)
- Multiplies this arbitrary-precision integer by a 64-bit signed integer and returns the result.[Multiply(PeterO.Numbers.EInteger)](#Multiply_PeterO_Numbers_EInteger)
- Multiplies this arbitrary-precision integer by another arbitrary-precision integer and returns the result.[Negate()](#Negate)
- Gets the value of this object with the sign reversed.[Not()](#Not)
- Returns an arbitrary-precision integer with every bit flipped from this one (also called an inversion or NOT operation).[Not(PeterO.Numbers.EInteger)](#Not_PeterO_Numbers_EInteger)
- Returns an arbitrary-precision integer with every bit flipped.[One](#One)
- Gets the number 1 as an arbitrary-precision integer.[PeterO.Numbers.EInteger operator +(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#op_Addition)
- Adds an arbitrary-precision integer and another arbitrary-precision integer and returns the result.[PeterO.Numbers.EInteger operator &(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#op_BitwiseAnd)
- Does an AND operation between two arbitrary-precision integer values.[PeterO.Numbers.EInteger operator |(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#op_BitwiseOr)
- Does an OR operation between two arbitrary-precision integer instances.[PeterO.Numbers.EInteger operator --(PeterO.Numbers.EInteger)](#op_Decrement)
- Subtracts one from an arbitrary-precision integer.[PeterO.Numbers.EInteger operator /(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#op_Division)
- Divides an arbitrary-precision integer by the value of an arbitrary-precision integer object.[PeterO.Numbers.EInteger operator ^(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#op_ExclusiveOr)
- Finds the exclusive “or” of two arbitrary-precision integer objects.[bool operator >(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#op_GreaterThan)
- Determines whether an arbitrary-precision integer is greater than another arbitrary-precision integer.[bool operator >=(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#op_GreaterThanOrEqual)
- Determines whether an arbitrary-precision integer value is greater than another arbitrary-precision integer.[PeterO.Numbers.EInteger operator ++(PeterO.Numbers.EInteger)](#op_Increment)
- Adds one to an arbitrary-precision integer.[PeterO.Numbers.EInteger operator <<(PeterO.Numbers.EInteger, int)](#op_LeftShift)
- Returns an arbitrary-precision integer with the bits shifted to the left by a number of bits.[bool operator <(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#op_LessThan)
- Determines whether an arbitrary-precision integer is less than another arbitrary-precision integer.[bool operator <=(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#op_LessThanOrEqual)
- Determines whether an arbitrary-precision integer is up to another arbitrary-precision integer.[PeterO.Numbers.EInteger operator %(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#op_Modulus)
- Returns the remainder that would result when an arbitrary-precision integer is divided by another arbitrary-precision integer.[PeterO.Numbers.EInteger operator *(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#op_Multiply)
- Multiplies an arbitrary-precision integer by another arbitrary-precision integer and returns the result.[PeterO.Numbers.EInteger operator ~(PeterO.Numbers.EInteger)](#op_OnesComplement)
- Returns an arbitrary-precision integer with every bit flipped.[PeterO.Numbers.EInteger operator >>(PeterO.Numbers.EInteger, int)](#op_RightShift)
- Shifts the bits of an arbitrary-precision integer to the right.[PeterO.Numbers.EInteger operator -(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#op_Subtraction)
- Subtracts two arbitrary-precision integer values.[PeterO.Numbers.EInteger operator -(PeterO.Numbers.EInteger)](#op_UnaryNegation)
- Negates an arbitrary-precision integer.[Or(PeterO.Numbers.EInteger)](#Or_PeterO_Numbers_EInteger)
- Does an OR operation between this arbitrary-precision integer and another one.[Or(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#Or_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger)
- Does an OR operation between two arbitrary-precision integer instances.[OrNot(PeterO.Numbers.EInteger)](#OrNot_PeterO_Numbers_EInteger)
- Does an OR NOT operation between this arbitrary-precision integer and another one.[Pow(int)](#Pow_int)
- Raises an arbitrary-precision integer to a power.[Pow(long)](#Pow_long)
- Raises an arbitrary-precision integer to a power.[Pow(PeterO.Numbers.EInteger)](#Pow_PeterO_Numbers_EInteger)
- Raises an arbitrary-precision integer to a power.[PowBigIntVar(PeterO.Numbers.EInteger)](#PowBigIntVar_PeterO_Numbers_EInteger)
- Obsolete: Use Pow instead.[Remainder(int)](#Remainder_int)
- Returns the remainder that would result when this arbitrary-precision integer is divided by a 32-bit signed integer.[Remainder(long)](#Remainder_long)
- Returns the remainder that would result when this arbitrary-precision integer is divided by a 64-bit signed integer.[Remainder(PeterO.Numbers.EInteger)](#Remainder_PeterO_Numbers_EInteger)
- Returns the remainder that would result when this arbitrary-precision integer is divided by another arbitrary-precision integer.[Root(int)](#Root_int)
- Finds the nth root of this instance’s value, rounded down.[Root(PeterO.Numbers.EInteger)](#Root_PeterO_Numbers_EInteger)
- Finds the nth root of this instance’s value, rounded down.[RootRem(int)](#RootRem_int)
- Calculates the nth root and the remainder.[RootRem(PeterO.Numbers.EInteger)](#RootRem_PeterO_Numbers_EInteger)
- Calculates the nth root and the remainder.[ShiftLeft(int)](#ShiftLeft_int)
- Returns an arbitrary-precision integer with the bits shifted to the left by a number of bits.[ShiftLeft(PeterO.Numbers.EInteger)](#ShiftLeft_PeterO_Numbers_EInteger)
- Returns an arbitrary-precision integer with the bits shifted to the left by a number of bits given as an arbitrary-precision integer.[ShiftRight(int)](#ShiftRight_int)
- Returns an arbitrary-precision integer with the bits shifted to the right.[ShiftRight(PeterO.Numbers.EInteger)](#ShiftRight_PeterO_Numbers_EInteger)
- Returns an arbitrary-precision integer with the bits shifted to the right.[Sign](#Sign)
- Gets the sign of this object’s value.[Sqrt()](#Sqrt)
- Finds the square root of this instance’s value, rounded down.[SqrtRem()](#SqrtRem)
- Calculates the square root and the remainder.[Subtract(int)](#Subtract_int)
- Subtracts a 32-bit signed integer from this arbitrary-precision integer and returns the result.[Subtract(long)](#Subtract_long)
- Subtracts a 64-bit signed integer from this arbitrary-precision integer and returns the result.[Subtract(PeterO.Numbers.EInteger)](#Subtract_PeterO_Numbers_EInteger)
- Subtracts an arbitrary-precision integer from this arbitrary-precision integer and returns the result.[Ten](#Ten)
- Gets the number 10 as an arbitrary-precision integer.[ToByteChecked()](#ToByteChecked)
- Converts this number’s value to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255).[ToBytes(bool)](#ToBytes_bool)
- Returns a byte array of this integer’s value.[ToByteUnchecked()](#ToByteUnchecked)
- Converts this number to a byte (from 0 to 255), returning the least-significant bits of this number’s two’s-complement form.[ToInt16Checked()](#ToInt16Checked)
- Converts this number’s value to a 16-bit signed integer if it can fit in a 16-bit signed integer.[ToInt16Unchecked()](#ToInt16Unchecked)
- Converts this number to a 16-bit signed integer, returning the least-significant bits of this number’s two’s-complement form.[ToInt32Checked()](#ToInt32Checked)
- Converts this object’s value to a 32-bit signed integer, throwing an exception if it can’t fit.[ToInt32Unchecked()](#ToInt32Unchecked)
- Converts this object’s value to a 32-bit signed integer.[ToInt64Checked()](#ToInt64Checked)
- Converts this object’s value to a 64-bit signed integer, throwing an exception if it can’t fit.[ToInt64Unchecked()](#ToInt64Unchecked)
- Converts this object’s value to a 64-bit signed integer.[ToRadixString(int)](#ToRadixString_int)
- Generates a string representing the value of this object, in the specified radix.[ToSByteChecked()](#ToSByteChecked)
- Converts this number’s value to an 8-bit signed integer if it can fit in an 8-bit signed integer.[ToSByteUnchecked()](#ToSByteUnchecked)
- Converts this number to an 8-bit signed integer, returning the least-significant bits of this number’s two’s-complement form.[ToString()](#ToString)
- Converts this object to a text string in base 10.[ToUInt16Checked()](#ToUInt16Checked)
- Converts this number’s value to a 16-bit unsigned integer if it can fit in a 16-bit unsigned integer.[ToUInt16Unchecked()](#ToUInt16Unchecked)
- Converts this number to a 16-bit unsigned integer, returning the least-significant bits of this number’s two’s-complement form.[ToUInt32Checked()](#ToUInt32Checked)
- Converts this number’s value to a 32-bit signed integer if it can fit in a 32-bit signed integer.[ToUInt32Unchecked()](#ToUInt32Unchecked)
- Converts this number to a 32-bit signed integer, returning the least-significant bits of this number’s two’s-complement form.[ToUInt64Checked()](#ToUInt64Checked)
- Converts this number’s value to a 64-bit signed integer if it can fit in a 64-bit signed integer.[ToUInt64Unchecked()](#ToUInt64Unchecked)
- Converts this number to a 64-bit signed integer, returning the least-significant bits of this number’s two’s-complement form.[Xor(PeterO.Numbers.EInteger)](#Xor_PeterO_Numbers_EInteger)
- Does an exclusive OR (XOR) operation between this arbitrary-precision integer and another one.[Xor(PeterO.Numbers.EInteger, PeterO.Numbers.EInteger)](#Xor_PeterO_Numbers_EInteger_PeterO_Numbers_EInteger)
- Finds the exclusive “or” of two arbitrary-precision integer objects.[XorNot(PeterO.Numbers.EInteger)](#XorNot_PeterO_Numbers_EInteger)
- Does an XOR NOT operation (or equivalence operation, EQV operation, or exclusive-OR NOT operation) between this arbitrary-precision integer and another one.[Zero](#Zero)
- Gets the number zero as an arbitrary-precision integer.
public bool IsEven { get; }
Gets a value indicating whether this value is even.
Returns:
true
if this value is even; otherwise, false
.
public bool IsPowerOfTwo { get; }
Gets a value indicating whether this object’s value is a power of two, and greater than 0.
Returns:
true
if this object’s value is a power of two, and greater than 0; otherwise, false
.
public bool IsZero { get; }
Gets a value indicating whether this value is 0.
Returns:
true
if this value is 0; otherwise, false
.
public static PeterO.Numbers.EInteger One { get; }
Gets the number 1 as an arbitrary-precision integer.
Returns:
The number 1 as an arbitrary-precision integer.
public int Sign { get; }
Gets the sign of this object’s value.
Returns:
The sign of this object’s value.
public static PeterO.Numbers.EInteger Ten { get; }
Gets the number 10 as an arbitrary-precision integer.
Returns:
The number 10 as an arbitrary-precision integer.
public static PeterO.Numbers.EInteger Zero { get; }
Gets the number zero as an arbitrary-precision integer.
Returns:
The number zero as an arbitrary-precision integer.
public PeterO.Numbers.EInteger Abs();
Returns the absolute value of this object’s value.
Return Value:
This object’s value with the sign removed.
public PeterO.Numbers.EInteger Add( int intValue);
Adds this arbitrary-precision integer and a 32-bit signed integer and returns the result.
Parameters:
- intValue: The parameter intValue is a 32-bit signed integer.
Return Value:
The sum of the two numbers, that is, this arbitrary-precision integer plus a 32-bit signed integer.
public PeterO.Numbers.EInteger Add( long longValue);
Adds this arbitrary-precision integer and a 64-bit signed integer and returns the result.
Parameters:
- longValue: The parameter longValue is a 64-bit signed integer.
Return Value:
The sum of the two numbers, that is, this arbitrary-precision integer plus a 64-bit signed integer.
public PeterO.Numbers.EInteger Add( PeterO.Numbers.EInteger bigintAugend);
Adds this arbitrary-precision integer and another arbitrary-precision integer and returns the result.
Parameters:
- bigintAugend: Another arbitrary-precision integer.
Return Value:
The sum of the two numbers, that is, this arbitrary-precision integer plus another arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter bigintAugend is null.
public PeterO.Numbers.EInteger And( PeterO.Numbers.EInteger other);
Does an AND operation between this arbitrary-precision integer and another one.
Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
- other: Another arbitrary-precision integer that participates in the operation.
Return Value:
An arbitrary-precision integer in which each bit is set if the corresponding bits of this integer and the other integer (in their two’s-complement representation) are both set. For example, in binary, 10110 AND 01100 = 00100 (or in decimal, 22 AND 12 = 4). This method uses the two’s complement form of negative integers (see "Forms of numbers"“Forms of numbers” ). For example, in binary, …11100111 AND 01100 = 00100 (or in decimal, -25 AND 12 = 4).
Exceptions:
- System.ArgumentNullException: The parameter other is null.
public static PeterO.Numbers.EInteger And( PeterO.Numbers.EInteger a, PeterO.Numbers.EInteger b);
Does an AND operation between two arbitrary-precision integer values.
Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
-
a: The first arbitrary-precision integer.
-
b: The second arbitrary-precision integer.
Return Value:
An arbitrary-precision integer in which each bit is set if the corresponding bits of the two integers are both set.
Exceptions:
- System.ArgumentNullException: The parameter a or b is null.
public PeterO.Numbers.EInteger AndNot( PeterO.Numbers.EInteger second);
Does an AND NOT operation between this arbitrary-precision integer and another one.
Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
- second: Another arbitrary-precision integer that participates in the operation.
Return Value:
An arbitrary-precision integer in which each bit is set if the corresponding bit of this integer is set, and the other integer’s corresponding bit is not set. For example, in binary, 10110 AND NOT 11010 = 00100 (or in decimal, 22 AND NOT 26 = 4). This method uses the two’s complement form of negative integers (see "Forms of numbers"“Forms of numbers” ). For example, in binary, …11101110 AND NOT 01011 = 00100 (or in decimal, -18 OR 11 = 4).
Exceptions:
- System.ArgumentNullException: The parameter second is null.
public int AsInt32Checked();
Obsolete. Renamed to ToInt32Checked.
Converts this object’s value to a 32-bit signed integer, throwing an exception if it can’t fit.
Return Value:
A 32-bit signed integer.
Exceptions:
- T:System.OverflowException: This object’s value is too big to fit a 32-bit signed integer.
public int AsInt32Unchecked();
Obsolete. Renamed to ToInt32Unchecked.
Converts this object’s value to a 32-bit signed integer. If the value can’t fit in a 32-bit integer, returns the lower 32 bits of this object’s two’s-complement form (see "Forms of numbers"“Forms of numbers” ) (in which case the return value might have a different sign than this object’s value).
Return Value:
A 32-bit signed integer.
public long AsInt64Checked();
Obsolete. Renamed to ToInt64Checked.
Converts this object’s value to a 64-bit signed integer, throwing an exception if it can’t fit.
Return Value:
A 64-bit signed integer.
Exceptions:
- T:System.OverflowException: This object’s value is too big to fit a 64-bit signed integer.
public long AsInt64Unchecked();
Obsolete. Renamed to ToInt64Unchecked.
Converts this object’s value to a 64-bit signed integer. If the value can’t fit in a 64-bit integer, returns the lower 64 bits of this object’s two’s-complement form (see "Forms of numbers"“Forms of numbers” ) (in which case the return value might have a different sign than this object’s value).
Return Value:
A 64-bit signed integer.
public bool CanFitInInt32();
Returns whether this object’s value can fit in a 32-bit signed integer.
Return Value:
true
if this object’s value is from -2147483648 through 2147483647; otherwise, false
.
public bool CanFitInInt64();
Returns whether this object’s value can fit in a 64-bit signed integer.
Return Value:
true
if this object’s value is from -9223372036854775808 through 9223372036854775807; otherwise, false
.
public int CompareTo( int intValue);
Compares an arbitrary-precision integer with this instance.
Parameters:
- intValue: The parameter intValue is a 32-bit signed integer.
Return Value:
Zero if the values are equal; a negative number if this instance is less, or a positive number if this instance is greater.
public int CompareTo( long longValue);
Compares an arbitrary-precision integer with this instance.
Parameters:
- longValue: The parameter longValue is a 64-bit signed integer.
Return Value:
Zero if the values are equal; a negative number if this instance is less, or a positive number if this instance is greater.
public sealed int CompareTo( PeterO.Numbers.EInteger other);
Compares an arbitrary-precision integer with this instance.
Parameters:
- other: The integer to compare to this value.
Return Value:
Zero if the values are equal; a negative number if this instance is less, or a positive number if this instance is greater. This implementation returns a positive number if other
is null, to conform to the.NET definition of CompareTo. This is the case even in the Java version of this library, for consistency’s sake, even though implementations of Comparable.CompareTo()
in Java ought to throw an exception if they receive a null argument rather than treating null as less or greater than any object.
.
public PeterO.Numbers.EInteger Decrement();
Returns one subtracted from this arbitrary-precision integer.
Return Value:
The given arbitrary-precision integer minus one.
public PeterO.Numbers.EInteger Divide( int intValue);
Divides this arbitrary-precision integer by a 32-bit signed integer and returns the result. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other 32-bit signed integer is negative, or vice versa, and will be positive if both are positive or both are negative.
Parameters:
- intValue: The divisor.
Return Value:
The result of dividing this arbitrary-precision integer by a 32-bit signed integer. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other 32-bit signed integer is negative, or vice versa, and will be positive if both are positive or both are negative.
Exceptions:
- System.DivideByZeroException: Attempted to divide by zero.
public PeterO.Numbers.EInteger Divide( long longValue);
Divides this arbitrary-precision integer by a 64-bit signed integer and returns the result. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other 64-bit signed integer is negative, or vice versa, and will be positive if both are positive or both are negative.
Parameters:
- longValue: The parameter longValue is a 64-bit signed integer.
Return Value:
The result of dividing this arbitrary-precision integer by a 64-bit signed integer. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other 64-bit signed integer is negative, or vice versa, and will be positive if both are positive or both are negative.
public PeterO.Numbers.EInteger Divide( PeterO.Numbers.EInteger bigintDivisor);
Divides this arbitrary-precision integer by another arbitrary-precision integer and returns the result. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other arbitrary-precision integer is negative, or vice versa, and will be positive if both are positive or both are negative.
Parameters:
- bigintDivisor: The divisor.
Return Value:
The result of dividing this arbitrary-precision integer by another arbitrary-precision integer. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other arbitrary-precision integer is negative, or vice versa, and will be positive if both are positive or both are negative.
Exceptions:
-
System.ArgumentNullException: The parameter bigintDivisor is null.
-
System.DivideByZeroException: Attempted to divide by zero.
public PeterO.Numbers.EInteger[] DivRem( int intDivisor);
Divides this arbitrary-precision integer by a 32-bit signed integer and returns a two-item array containing the result of the division and the remainder, in that order. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other 32-bit signed integer is negative, or vice versa, and will be positive if both are positive or both are negative. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other 32-bit signed integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
Parameters:
- intDivisor: The number to divide by.
Return Value:
An array of two items: the first is the result of the division as an arbitrary-precision integer, and the second is the remainder as an arbitrary-precision integer. The result of division is the result of the Divide method on the two operands, and the remainder is the result of the Remainder method on the two operands.
Exceptions:
- System.DivideByZeroException: The parameter intDivisor is 0.
public PeterO.Numbers.EInteger[] DivRem( long intDivisor);
Divides this arbitrary-precision integer by a 64-bit signed integer and returns a two-item array containing the result of the division and the remainder, in that order. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other 64-bit signed integer is negative, or vice versa, and will be positive if both are positive or both are negative. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other 64-bit signed integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
Parameters:
- intDivisor: The parameter intDivisor is a 64-bit signed integer.
Return Value:
An array of two items: the first is the result of the division as an arbitrary-precision integer, and the second is the remainder as an arbitrary-precision integer. The result of division is the result of the Divide method on the two operands, and the remainder is the result of the Remainder method on the two operands.
public PeterO.Numbers.EInteger[] DivRem( PeterO.Numbers.EInteger divisor);
Divides this arbitrary-precision integer by another arbitrary-precision integer and returns a two-item array containing the result of the division and the remainder, in that order. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other arbitrary-precision integer is negative, or vice versa, and will be positive if both are positive or both are negative. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other arbitrary-precision integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
Parameters:
- divisor: The number to divide by.
Return Value:
An array of two items: the first is the result of the division as an arbitrary-precision integer, and the second is the remainder as an arbitrary-precision integer. The result of division is the result of the Divide method on the two operands, and the remainder is the result of the Remainder method on the two operands.
Exceptions:
-
System.DivideByZeroException: The parameter divisor is 0.
-
System.ArgumentNullException: The parameter divisor is null.
public static PeterO.Numbers.EInteger DivRem( PeterO.Numbers.EInteger dividend, PeterO.Numbers.EInteger divisor, PeterO.Numbers.EInteger& remainder);
Obsolete. Use the DivRem instance method instead.
Divides this arbitrary-precision integer by another arbitrary-precision integer and returns a two-item array containing the result of the division and the remainder, in that order. The result of the division is rounded down (the fractional part is discarded). Except if the result of the division is 0, it will be negative if this arbitrary-precision integer is positive and the other arbitrary-precision integer is negative, or vice versa, and will be positive if both are positive or both are negative. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other arbitrary-precision integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
Parameters:
-
dividend: The arbitrary-precision integer to be divided.
-
divisor: The arbitrary-precision integer to divide by.
-
remainder: An arbitrary-precision integer.
Return Value:
An array of two items: the first is the result of the division as an arbitrary-precision integer, and the second is the remainder as an arbitrary-precision integer. The result of division is the result of the Divide method on the two operands, and the remainder is the result of the Remainder method on the two operands.
Exceptions:
- System.ArgumentNullException: The parameter dividend or divisor is null.
public override bool Equals( object obj);
Determines whether this object and another object are equal and have the same type.
Parameters:
- obj: The parameter obj is an arbitrary object.
Return Value:
true
if this object and another object are equal; otherwise, false
.
public sealed bool Equals( PeterO.Numbers.EInteger other);
Determines whether this object and another object are equal.
Parameters:
- other: Another arbitrary-precision integer.
Return Value:
true
if this object and another object are equal; otherwise, false
.
public PeterO.Numbers.EInteger Eqv( PeterO.Numbers.EInteger second);
Does an XOR NOT operation (or equivalence operation, EQV operation, or exclusive-OR NOT operation) between this arbitrary-precision integer and another one.
Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
- second: Another arbitrary-precision integer that participates in the operation.
Return Value:
An arbitrary-precision integer in which each bit is set if the corresponding bit of this integer is set or the other integer’s corresponding bit is not set, but not both. For example, in binary, 10110 XOR NOT 11010 = 10011 (or in decimal, 22 XOR NOT 26 = 19). This method uses the two’s complement form of negative integers (see "Forms of numbers"“Forms of numbers” ). For example, in binary, …11101110 XOR NOT 01011 = …11111010 (or in decimal, -18 OR 11 = -6).
Exceptions:
- System.ArgumentNullException: The parameter second is null.
public static PeterO.Numbers.EInteger FromBoolean( bool boolValue);
Converts a Boolean value (true or false) to an arbitrary-precision integer.
Parameters:
- boolValue: Either true or false.
Return Value:
The number 1 if boolValue is true; otherwise, 0.
public static PeterO.Numbers.EInteger FromByte( byte inputByte);
Converts a byte (from 0 to 255) to an arbitrary-precision integer.
Parameters:
- inputByte: The number to convert as a byte (from 0 to 255).
Return Value:
This number’s value as an arbitrary-precision integer.
public static PeterO.Numbers.EInteger FromBytes( byte[] bytes, bool littleEndian);
Initializes an arbitrary-precision integer from an array of bytes.
Parameters:
-
bytes: A byte array consisting of the two’s-complement form (see "Forms of numbers"“Forms of numbers” ) of the arbitrary-precision integer to create. The byte array is encoded using the rules given in the FromBytes(bytes, offset, length, littleEndian) overload.
-
littleEndian: If true, the byte order is little-endian, or least-significant-byte first. If false, the byte order is big-endian, or most-significant-byte first.
Return Value:
An arbitrary-precision integer. Returns 0 if the byte array’s length is 0.
Exceptions:
- System.ArgumentNullException: The parameter bytes is null.
public static PeterO.Numbers.EInteger FromBytes( byte[] bytes, int offset, int length, bool littleEndian);
Initializes an arbitrary-precision integer from a portion of an array of bytes. The portion of the byte array is encoded using the following rules:
-
Positive numbers have the first byte’s highest bit cleared, and negative numbers have the bit set.
-
The last byte contains the lowest 8-bits, the next-to-last contains the next lowest 8 bits, and so on. For example, the number 300 can be encoded as
0x01, 0x2C
and 200 as0x00, 0xC8
. (Note that the second example contains a set high bit in0xC8
, so an additional 0 is added at the start to ensure it’s interpreted as positive.) -
To encode negative numbers, take the absolute value of the number, subtract by 1, encode the number into bytes, and reverse each bit of each byte. Any further bits that appear beyond the most significant bit of the number will be all ones. For example, the number -450 can be encoded as
0xfe, 0x70
and -52869 as0xff, 0x31, 0x7B
. (Note that the second example contains a cleared high bit in0x31, 0x7B
, so an additional 0xff is added at the start to ensure it’s interpreted as negative.)
For little-endian, the byte order is reversed from the byte order just discussed.
Parameters:
-
bytes: A byte array consisting of the two’s-complement form (see "Forms of numbers"“Forms of numbers” ) of the arbitrary-precision integer to create. The byte array is encoded using the rules given in the FromBytes(bytes, offset, length, littleEndian) overload.
-
offset: An index starting at 0 showing where the desired portion of bytes begins.
-
length: The length, in bytes, of the desired portion of bytes (but not more than bytes ‘s length).
-
littleEndian: If true, the byte order is little-endian, or least-significant-byte first. If false, the byte order is big-endian, or most-significant-byte first.
Return Value:
An arbitrary-precision integer. Returns 0 if the byte array’s length is 0.
Exceptions:
-
System.ArgumentNullException: The parameter bytes is null.
-
System.ArgumentException: Either offset or length is less than 0 or greater than bytes ‘s length, or bytes ‘s length minus offset is less than length .
public static PeterO.Numbers.EInteger FromInt16( short inputInt16);
Converts a 16-bit signed integer to an arbitrary-precision integer.
Parameters:
- inputInt16: The number to convert as a 16-bit signed integer.
Return Value:
This number’s value as an arbitrary-precision integer.
public static PeterO.Numbers.EInteger FromInt32( int intValue);
Converts a 32-bit signed integer to an arbitrary-precision integer.
Parameters:
- intValue: The parameter intValue is a 32-bit signed integer.
Return Value:
An arbitrary-precision integer with the same value as the 64-bit number.
public static PeterO.Numbers.EInteger FromInt64( long longerValue);
Converts a 64-bit signed integer to an arbitrary-precision integer.
Parameters:
- longerValue: The parameter longerValue is a 64-bit signed integer.
Return Value:
An arbitrary-precision integer with the same value as the 64-bit number.
public static PeterO.Numbers.EInteger FromInt64AsUnsigned( long longerValue);
Converts an unsigned integer expressed as a 64-bit signed integer to an arbitrary-precision integer.
Parameters:
- longerValue: A 64-bit signed integer. If this value is 0 or greater, the return value will represent it. If this value is less than 0, the return value will store 2^64 plus this value instead.
Return Value:
An arbitrary-precision integer. If longerValue is 0 or greater, the return value will represent it. If longerValue is less than 0, the return value will store 2^64 plus this value instead.
public static PeterO.Numbers.EInteger FromRadixString( byte[] bytes, int radix);
Converts a sequence of bytes (interpreted as text) to an arbitrary-precision integer in a given radix. Each byte in the sequence has to be a character in the Basic Latin range (0x00 to 0x7f or U+0000 to U+007F) of the Unicode Standard.
Parameters:
-
bytes: A sequence of bytes (interpreted as text) described by the FromRadixSubstring method.
-
radix: A base from 2 to 36. Depending on the radix, the sequence of bytes can use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic uppercase letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16. Where a basic uppercase letter A to Z is allowed in the sequence of bytes, the corresponding basic lowercase letter (U+0061 to U+007a) is allowed instead.
Return Value:
An arbitrary-precision integer with the same value as the specified sequence of bytes.
Exceptions:
-
System.ArgumentNullException: The parameter bytes is null.
-
System.FormatException: The sequence of bytes (interpreted as text) is empty or in an invalid format.
public static PeterO.Numbers.EInteger FromRadixString( char[] cs, int radix);
Converts a sequence of char
s to an arbitrary-precision integer in a given radix.
Parameters:
-
cs: A sequence of
char
s described by the FromRadixSubstring method. -
radix: A base from 2 to 36. Depending on the radix, the sequence of
char
s can use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic uppercase letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16. Where a basic uppercase letter A to Z is allowed in the sequence ofchar
s, the corresponding basic lowercase letter (U+0061 to U+007a) is allowed instead.
Return Value:
An arbitrary-precision integer with the same value as the specified sequence of char
s.
Exceptions:
-
System.ArgumentNullException: The parameter cs is null.
-
System.FormatException: The sequence of
char
s is empty or in an invalid format.
public static PeterO.Numbers.EInteger FromRadixString( string str, int radix);
Converts a string to an arbitrary-precision integer in a given radix.
Parameters:
-
str: A string described by the FromRadixSubstring method.
-
radix: A base from 2 to 36. Depending on the radix, the string can use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic uppercase letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16. Where a basic uppercase letter A to Z is allowed in the string, the corresponding basic lowercase letter (U+0061 to U+007a) is allowed instead.
Return Value:
An arbitrary-precision integer with the same value as the specified string.
Exceptions:
-
System.ArgumentNullException: The parameter str is null.
-
System.FormatException: The string is empty or in an invalid format.
public static PeterO.Numbers.EInteger FromRadixSubstring( byte[] bytes, int radix, int index, int endIndex);
Converts a portion of a sequence of bytes (interpreted as text) to an arbitrary-precision integer in a given radix. Each byte in the sequence has to be a character in the Basic Latin range (0x00 to 0x7f or U+0000 to U+007F) of the Unicode Standard.
Parameters:
-
bytes: A sequence of bytes (interpreted as text). The desired portion of the sequence of bytes (interpreted as text) must contain only characters allowed by the specified radix, except that it may start with a minus sign (“-“, U+002D) to indicate a negative number. The desired portion is not allowed to contain white space characters, including spaces. The desired portion may start with any number of zeros.
-
radix: A base from 2 to 36. Depending on the radix, the sequence of bytes (interpreted as text) can use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic uppercase letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16. Where a basic uppercase letter A to Z is allowed in the sequence of bytes (interpreted as text), the corresponding basic lowercase letter (U+0061 to U+007a) is allowed instead.
-
index: The index of the sequence of bytes (interpreted as text) that starts the desired portion.
-
endIndex: The index of the sequence of bytes (interpreted as text) that ends the desired portion. The length will be index + endIndex - 1.
Return Value:
An arbitrary-precision integer with the same value as given in the sequence’s portion.
Exceptions:
-
System.ArgumentNullException: The parameter bytes is null.
-
System.FormatException: The portion is empty or in an invalid format.
public static PeterO.Numbers.EInteger FromRadixSubstring( char[] cs, int radix, int index, int endIndex);
Converts a portion of a sequence of char
s to an arbitrary-precision integer in a given radix.
Parameters:
-
cs: A text sequence of
char
s. The desired portion of the sequence ofchar
s must contain only characters allowed by the specified radix, except that it may start with a minus sign (“-“, U+002D) to indicate a negative number. The desired portion is not allowed to contain white space characters, including spaces. The desired portion may start with any number of zeros. -
radix: A base from 2 to 36. Depending on the radix, the sequence of
char
s can use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic uppercase letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16. Where a basic uppercase letter A to Z is allowed in the sequence ofchar
s, the corresponding basic lowercase letter (U+0061 to U+007a) is allowed instead. -
index: The index of the sequence of
char
s that starts the desired portion. -
endIndex: The index of the sequence of
char
s that ends the desired portion. The length will be index + endIndex - 1.
Return Value:
An arbitrary-precision integer with the same value as given in the sequence’s portion.
Exceptions:
-
System.ArgumentNullException: The parameter cs is null.
-
System.FormatException: The portion is empty or in an invalid format.
public static PeterO.Numbers.EInteger FromRadixSubstring( string str, int radix, int index, int endIndex);
Converts a portion of a string to an arbitrary-precision integer in a given radix.
Parameters:
-
str: A text string. The desired portion of the string must contain only characters allowed by the specified radix, except that it may start with a minus sign (“-“, U+002D) to indicate a negative number. The desired portion is not allowed to contain white space characters, including spaces. The desired portion may start with any number of zeros.
-
radix: A base from 2 to 36. Depending on the radix, the string can use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic uppercase letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16. Where a basic uppercase letter A to Z is allowed in the string, the corresponding basic lowercase letter (U+0061 to U+007a) is allowed instead.
-
index: The index of the string that starts the string portion.
-
endIndex: The index of the string that ends the string portion. The length will be index + endIndex - 1.
Return Value:
An arbitrary-precision integer with the same value as given in the string portion.
Exceptions:
-
System.ArgumentNullException: The parameter str is null.
-
System.FormatException: The string portion is empty or in an invalid format.
public static PeterO.Numbers.EInteger FromSByte( sbyte inputSByte);
This API is not CLS-compliant.
Converts an 8-bit signed integer to an arbitrary-precision integer.
Parameters:
- inputSByte: The number to convert as an 8-bit signed integer.
Return Value:
This number’s value as an arbitrary-precision integer.
public static PeterO.Numbers.EInteger FromString( byte[] bytes);
Converts a sequence of bytes (interpreted as text) to an arbitrary-precision integer. Each byte in the sequence has to be a code point in the Basic Latin range (0x00 to 0x7f or U+0000 to U+007F) of the Unicode Standard.
Parameters:
- bytes: A sequence of bytes describing an integer in base-10 (decimal) form. The sequence must contain only basic digits 0 to 9 (U+0030 to U+0039), except that it may start with a minus sign (“-“, U+002D) to indicate a negative number. The sequence is not allowed to contain white space characters, including spaces. The sequence may start with any number of zeros.
Return Value:
An arbitrary-precision integer with the same value as given in the sequence of bytes.
Exceptions:
-
System.FormatException: The parameter bytes is in an invalid format.
-
System.ArgumentNullException: The parameter bytes is null.
public static PeterO.Numbers.EInteger FromString( char[] cs);
Converts a sequence of char
s to an arbitrary-precision integer.
Parameters:
- cs: A sequence of
char
s describing an integer in base-10 (decimal) form. The sequence must contain only basic digits 0 to 9 (U+0030 to U+0039), except that it may start with a minus sign (“-“, U+002D) to indicate a negative number. The sequence is not allowed to contain white space characters, including spaces. The sequence may start with any number of zeros.
Return Value:
An arbitrary-precision integer with the same value as given in the sequence of char
s.
Exceptions:
-
System.FormatException: The parameter cs is in an invalid format.
-
System.ArgumentNullException: The parameter cs is null.
public static PeterO.Numbers.EInteger FromString( string str);
Converts a string to an arbitrary-precision integer.
Parameters:
- str: A text string describing an integer in base-10 (decimal) form. The string must contain only basic digits 0 to 9 (U+0030 to U+0039), except that it may start with a minus sign (“-“, U+002D) to indicate a negative number. The string is not allowed to contain white space characters, including spaces. The string may start with any number of zeros.
Return Value:
An arbitrary-precision integer with the same value as given in the string.
Exceptions:
-
System.FormatException: The parameter str is in an invalid format.
-
System.ArgumentNullException: The parameter str is null.
public static PeterO.Numbers.EInteger FromSubstring( byte[] bytes, int index, int endIndex);
Converts a portion of a sequence of bytes (interpreted as text) to an arbitrary-precision integer. Each byte in the sequence has to be a character in the Basic Latin range (0x00 to 0x7f or U+0000 to U+007F) of the Unicode Standard.
Parameters:
-
bytes: A sequence of bytes (interpreted as text), the desired portion of which describes an integer in base-10 (decimal) form. The desired portion of the sequence of bytes (interpreted as text) must contain only basic digits 0 to 9 (U+0030 to U+0039), except that it may start with a minus sign (“-“, U+002D) to indicate a negative number. The desired portion is not allowed to contain white space characters, including spaces. The desired portion may start with any number of zeros.
-
index: The index of the sequence of bytes (interpreted as text) that starts the desired portion.
-
endIndex: The index of the sequence of bytes (interpreted as text) that ends the desired portion. The length will be index + endIndex - 1.
Return Value:
An arbitrary-precision integer with the same value as given in the sequence of bytes (interpreted as text) portion.
Exceptions:
-
System.ArgumentException: The parameter index is less than 0, endIndex is less than 0, or either is greater than the sequence’s length, or endIndex is less than index .
-
System.ArgumentNullException: The parameter bytes is null.
public static PeterO.Numbers.EInteger FromSubstring( char[] cs, int index, int endIndex);
Converts a portion of a sequence of char
s to an arbitrary-precision integer.
Parameters:
-
cs: A sequence of
char
s, the desired portion of which describes an integer in base-10 (decimal) form. The desired portion of the sequence ofchar
s must contain only basic digits 0 to 9 (U+0030 to U+0039), except that it may start with a minus sign (“-“, U+002D) to indicate a negative number. The desired portion is not allowed to contain white space characters, including spaces. The desired portion may start with any number of zeros. -
index: The index of the sequence of
char
s that starts the desired portion. -
endIndex: The index of the sequence of
char
s that ends the desired portion. The length will be index + endIndex - 1.
Return Value:
An arbitrary-precision integer with the same value as given in the sequence of char
s portion.
Exceptions:
-
System.ArgumentException: The parameter index is less than 0, endIndex is less than 0, or either is greater than the sequence’s length, or endIndex is less than index .
-
System.ArgumentNullException: The parameter cs is null.
public static PeterO.Numbers.EInteger FromSubstring( string str, int index, int endIndex);
Converts a portion of a string to an arbitrary-precision integer.
Parameters:
-
str: A text string, the desired portion of which describes an integer in base-10 (decimal) form. The desired portion of the string must contain only basic digits 0 to 9 (U+0030 to U+0039), except that it may start with a minus sign (“-“, U+002D) to indicate a negative number. The desired portion is not allowed to contain white space characters, including spaces. The desired portion may start with any number of zeros.
-
index: The index of the string that starts the string portion.
-
endIndex: The index of the string that ends the string portion. The length will be index + endIndex - 1.
Return Value:
An arbitrary-precision integer with the same value as given in the string portion.
Exceptions:
-
System.ArgumentException: The parameter index is less than 0, endIndex is less than 0, or either is greater than the string’s length, or endIndex is less than index .
-
System.ArgumentNullException: The parameter str is null.
public static PeterO.Numbers.EInteger FromUInt16( ushort inputUInt16);
This API is not CLS-compliant.
Converts a 16-bit unsigned integer to an arbitrary-precision integer.
Parameters:
- inputUInt16: The number to convert as a 16-bit unsigned integer.
Return Value:
This number’s value as an arbitrary-precision integer.
public static PeterO.Numbers.EInteger FromUInt32( uint inputUInt32);
This API is not CLS-compliant.
Converts a 32-bit signed integer to an arbitrary-precision integer.
Parameters:
- inputUInt32: The number to convert as a 32-bit signed integer.
Return Value:
This number’s value as an arbitrary-precision integer.
public static PeterO.Numbers.EInteger FromUInt64( ulong ulongValue);
This API is not CLS-compliant.
Converts a 64-bit unsigned integer to an arbitrary-precision integer.
Parameters:
- ulongValue: The number to convert as a 64-bit unsigned integer.
Return Value:
The value of ulongValue as an arbitrary-precision integer.
public PeterO.Numbers.EInteger Gcd( PeterO.Numbers.EInteger bigintSecond);
Returns the greatest common divisor of this integer and the specified integer. The greatest common divisor (GCD) is also known as the greatest common factor (GCF). This method works even if either or both integers are negative.
Parameters:
- bigintSecond: Another arbitrary-precision integer. Can be negative.
Return Value:
The greatest common divisor of this integer and the specified integer.
Exceptions:
-
System.ArgumentNullException: The parameter bigintSecond is null.
-
System.DivideByZeroException: Attempted to divide by zero.
-
System.ArgumentException: BigPower is negative.
public long GetBits( int index, int numberBits);
Retrieves bits from this integer’s two’s-complement form.
Parameters:
-
index: Zero-based index of the first bit to retrieve, where 0 is the least-significant bit of the number.
-
numberBits: The number of bits to retrieve, starting with the first. Must be from 0 through 64.
Return Value:
A 64-bit signed integer containing the bits from this integer’s two’s-complement form. The least significant bit is the first bit, and any unused bits are set to 0.
public int GetDigitCount();
Obsolete. This method may overflow. Use GetDigitCountAsEInteger instead.
Returns the number of decimal digits used by this integer.
Return Value:
The number of digits in the decimal form of this integer. Returns 1 if this number is 0.
Exceptions:
- System.OverflowException: The return value would exceed the range of a 32-bit signed integer.
public PeterO.Numbers.EInteger GetDigitCountAsEInteger();
Returns the number of decimal digits used by this integer, in the form of an arbitrary-precision integer.
Return Value:
The number of digits in the decimal form of this integer. Returns 1 if this number is 0.
public long GetDigitCountAsInt64();
Returns the number of decimal digits used by this integer, in the form of a 64-bit signed integer.
Return Value:
The number of digits in the decimal form of this integer. Returns 1 if this number is 0. Returns 2^63 - 1( Int64.MaxValue
in.NET or Long.MAX_VALUE
in Java) if the number of decimal digits is 2^63 - 1 or greater. (Use GetDigitCountAsEInteger
instead if the application relies on the exact number of decimal digits.).
public override int GetHashCode();
Returns the hash code for this instance. No application or process IDs are used in the hash code calculation.
Return Value:
A 32-bit signed integer.
public int GetLowBit();
Obsolete. This method may overflow. Use GetLowBitAsEInteger instead.
Gets the bit position of the lowest set bit in this number’s absolute value. (This will also be the position of the lowest set bit in the number’s two’s-complement form (see "Forms of numbers"“Forms of numbers” ).).
Return Value:
The bit position of the lowest bit set in the number’s absolute value, starting at 0. Returns -1 if this value is 0.
public PeterO.Numbers.EInteger GetLowBitAsEInteger();
Gets the bit position of the lowest set bit in this number’s absolute value, in the form of an arbitrary-precision integer. (This will also be the position of the lowest set bit in the number’s two’s-complement form (see "Forms of numbers"“Forms of numbers” ).).
Return Value:
The bit position of the lowest bit set in the number’s absolute value, starting at 0. Returns -1 if this value is 0 or odd.
public long GetLowBitAsInt64();
Gets the bit position of the lowest set bit in this number’s absolute value, in the form of a 64-bit signed integer. (This will also be the position of the lowest set bit in the number’s two’s-complement form (see "Forms of numbers"“Forms of numbers” ).).
Return Value:
The bit position of the lowest bit set in the number’s absolute value, starting at 0. Returns -1 if this value is 0 or odd. Returns 2^63 - 1 ( Int64.MaxValue
in.NET or Long.MAX_VALUE
in Java) if this number is other than zero but the lowest set bit is at 2^63 - 1 or greater. (Use GetLowBitAsEInteger
instead if the application relies on the exact value of the lowest set bit position.).
public bool GetSignedBit( int index);
Returns whether a bit is set in the two’s-complement form (see "Forms of numbers"“Forms of numbers” ) of this object’s value.
Parameters:
- index: The index, starting at 0, of the bit to test, where 0 is the least significant bit, 1 is the next least significant bit, and so on.
Return Value:
true
if the specified bit is set in the two’ s-complement form (see "Forms of numbers"“Forms of numbers” ) of this object’s value; otherwise, false
.
public bool GetSignedBit( PeterO.Numbers.EInteger bigIndex);
Returns whether a bit is set in the two’s-complement form (see "Forms of numbers"“Forms of numbers” ) of this object’s value.
Parameters:
- bigIndex: The index, starting at zero, of the bit to test, where 0 is the least significant bit, 1 is the next least significant bit, and so on.
Return Value:
true
if the specified bit is set in the two’ s-complement form (see "Forms of numbers"“Forms of numbers” ) of this object’s value; otherwise, false
.
Exceptions:
- System.ArgumentNullException: The parameter bigIndex is null.
public int GetSignedBitLength();
Obsolete. This method may overflow. Use GetSignedBitLengthAsEInteger instead.
Finds the minimum number of bits needed to represent this object’s value, except for its sign. If the value is negative, finds the number of bits in the value equal to this object’s absolute value minus 1. For example, all integers in the interval [-(2^63), (2^63) - 1], which is the same as the range of integers in Java’s and.NET’s long
type, have a signed bit length of 63 or less, and all other integers have a signed bit length of greater than 63.
Return Value:
The number of bits in this object’s value, except for its sign. Returns 0 if this object’s value is 0 or negative 1.
Exceptions:
- System.OverflowException: The return value would exceed the range of a 32-bit signed integer.
### GetSignedBitLengthAsEInteger
public PeterO.Numbers.EInteger GetSignedBitLengthAsEInteger();
Finds the minimum number of bits needed to represent this object’s value, except for its sign, and returns that number of bits as an arbitrary-precision integer. If the value is negative, finds the number of bits in the value equal to this object’s absolute value minus 1. For example, all integers in the interval [-(2^63), (2^63) - 1], which is the same as the range of integers in Java’s and.NET’s long
type, have a signed bit length of 63 or less, and all other integers have a signed bit length of greater than 63.
Return Value:
The number of bits in this object’s value, except for its sign. Returns 0 if this object’s value is 0 or negative 1.
public long GetSignedBitLengthAsInt64();
Finds the minimum number of bits needed to represent this object’s value, except for its sign, and returns that number of bits as a 64-bit signed integer. If the value is negative, finds the number of bits in the value equal to this object’s absolute value minus 1. For example, all integers in the interval [-(2^63), (2^63) - 1], which is the same as the range of integers in Java’s and.NET’s long
type, have a signed bit length of 63 or less, and all other integers have a signed bit length of greater than 63.
Return Value:
The number of bits in this object’s value, except for its sign. Returns 0 if this object’s value is 0 or negative 1. If the return value would be greater than 2^63 - 1 ( Int64.MaxValue
in.NET or Long.MAX_VALUE
in Java), returns 2^63 - 1 instead. (Use GetSignedBitLengthAsEInteger
instead of this method if the application relies on the exact number of bits.).
public bool GetUnsignedBit( int index);
Returns whether a bit is set in this number’s absolute value.
Parameters:
- index: The index, starting at 0, of the bit to test, where 0 is the least significant bit, 1 is the next least significant bit, and so on.
Return Value:
true
if the specified bit is set in this number’s absolute value.
public bool GetUnsignedBit( PeterO.Numbers.EInteger bigIndex);
Returns whether a bit is set in this number’s absolute value.
Parameters:
- bigIndex: The index, starting at zero, of the bit to test, where 0 is the least significant bit, 1 is the next least significant bit, and so on.
Return Value:
true
if the specified bit is set in this number’s absolute value.
Exceptions:
- System.ArgumentNullException: The parameter bigIndex is null.
public int GetUnsignedBitLength();
Obsolete. This method may overflow. Use GetUnsignedBitLengthAsEInteger instead.
Finds the minimum number of bits needed to represent this number’s absolute value. For example, all integers in the interval [-((2^63) - 1), (2^63) - 1] have an unsigned bit length of 63 or less, and all other integers have an unsigned bit length of greater than 63. This interval is not the same as the range of integers in Java’s and.NET’s long
type.
Return Value:
The number of bits in this object’s absolute value. Returns 0 if this object’s value is 0, and returns 1 if the value is negative 1.
Exceptions:
- System.OverflowException: The return value would exceed the range of a 32-bit signed integer.
### GetUnsignedBitLengthAsEInteger
public PeterO.Numbers.EInteger GetUnsignedBitLengthAsEInteger();
Finds the minimum number of bits needed to represent this number’s absolute value, and returns that number of bits as an arbitrary-precision integer. For example, all integers in the interval [-((2^63) - 1), (2^63) - 1] have an unsigned bit length of 63 or less, and all other integers have an unsigned bit length of greater than 63. This interval is not the same as the range of integers in Java’s and.NET’s long
type.
Return Value:
The number of bits in this object’s absolute value. Returns 0 if this object’s value is 0, and returns 1 if the value is negative 1.
### GetUnsignedBitLengthAsInt64
public long GetUnsignedBitLengthAsInt64();
Finds the minimum number of bits needed to represent this number’s absolute value, and returns that number of bits as a 64-bit signed integer. For example, all integers in the interval [-((2^63) - 1), (2^63) - 1] have an unsigned bit length of 63 or less, and all other integers have an unsigned bit length of greater than 63. This interval is not the same as the range of integers in Java’s and.NET’s long
type.
Return Value:
The number of bits in this object’s absolute value. Returns 0 if this object’s value is 0, and returns 1 if the value is negative 1. If the return value would be greater than 2^63 - 1( Int64.MaxValue
in.NET or Long.MAX_VALUE
in Java), returns 2^63 - 1 instead. (Use GetUnsignedBitLengthAsEInteger
instead of this method if the application relies on the exact number of bits.).
public PeterO.Numbers.EInteger Imp( PeterO.Numbers.EInteger second);
Obsolete. Does the incorrect implication operation. Use Imply instead.
Does an OR NOT operation between this arbitrary-precision integer and another one.
Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
- second: Another arbitrary-precision integer that participates in the operation.
Return Value:
An arbitrary-precision integer in which each bit is set if the corresponding bit of this integer is set, the other integer’s corresponding bit is not set, or both. For example, in binary, 10110 OR NOT 11010 = 00100 (or in decimal, 22 OR NOT 26 = 23). This method uses the two’s complement form of negative integers (see "Forms of numbers"“Forms of numbers” ). For example, in binary, …11101110 OR NOT 01011 = …11111110 (or in decimal, -18 OR 11 = -2).
Exceptions:
- System.ArgumentNullException: The parameter second is null.
public PeterO.Numbers.EInteger Increment();
Returns one added to this arbitrary-precision integer.
Return Value:
The given arbitrary-precision integer plus one.
public PeterO.Numbers.EInteger LowBits( int bitCount);
Extracts the lowest bits of this integer. This is equivalent to And(2^bitCount - 1)
, but is more efficient when this integer is nonnegative and bitCount’s value is large.
Parameters:
- bitCount: The number of bits to extract from the lowest part of this integer.
Return Value:
A value equivalent to And(2^bitCount - 1)
.
public PeterO.Numbers.EInteger LowBits( long longBitCount);
Extracts the lowest bits of this integer. This is equivalent to And(2^longBitCount - 1)
, but is more efficient when this integer is nonnegative and longBitCount’s value is large.
Parameters:
- longBitCount: The number of bits to extract from the lowest part of this integer.
Return Value:
A value equivalent to And(2^longBitCount - 1)
.
public PeterO.Numbers.EInteger LowBits( PeterO.Numbers.EInteger bigBitCount);
Extracts the lowest bits of this integer. This is equivalent to And(2^bigBitCount - 1)
, but is more efficient when this integer is nonnegative and bigBitCount’s value is large.
Parameters:
- bigBitCount: The number of bits to extract from the lowest part of this integer.
Return Value:
A value equivalent to And(2^bigBitCount - 1)
.
Exceptions:
- System.ArgumentNullException: The parameter bigBitCount is null.
public static PeterO.Numbers.EInteger Max( PeterO.Numbers.EInteger first, PeterO.Numbers.EInteger second);
Returns the greater of two arbitrary-precision integers.
Parameters:
-
first: The first integer to compare.
-
second: The second integer to compare.
Return Value:
The greater of the two integers.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public static PeterO.Numbers.EInteger MaxMagnitude( PeterO.Numbers.EInteger first, PeterO.Numbers.EInteger second);
Of two arbitrary-precision integers, returns the one with the greater absolute value. If both integers have the same absolute value, this method has the same effect as Max.
Parameters:
-
first: The first integer to compare.
-
second: The second integer to compare.
Return Value:
The integer with the greater absolute value.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public static PeterO.Numbers.EInteger Min( PeterO.Numbers.EInteger first, PeterO.Numbers.EInteger second);
Returns the smaller of two arbitrary-precision integers.
Parameters:
-
first: The first integer to compare.
-
second: The second integer to compare.
Return Value:
The smaller of the two integers.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public static PeterO.Numbers.EInteger MinMagnitude( PeterO.Numbers.EInteger first, PeterO.Numbers.EInteger second);
Of two arbitrary-precision integers, returns the one with the smaller absolute value. If both integers have the same absolute value, this method has the same effect as Min.
Parameters:
-
first: The first integer to compare.
-
second: The second integer to compare.
Return Value:
The integer with the smaller absolute value.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public PeterO.Numbers.EInteger Mod( int smallDivisor);
Finds the modulus remainder that results when this instance is divided by the value of another integer. The modulus remainder is the same as the normal remainder if the normal remainder is positive, and equals divisor plus normal remainder if the normal remainder is negative.
Parameters:
- smallDivisor: The divisor of the modulus.
Return Value:
The modulus remainder.
Exceptions:
- System.ArgumentException: The parameter smallDivisor is less than 0.
public PeterO.Numbers.EInteger Mod( PeterO.Numbers.EInteger divisor);
Finds the modulus remainder that results when this instance is divided by the value of an arbitrary-precision integer. The modulus remainder is the same as the normal remainder if the normal remainder is positive, and equals divisor plus normal remainder if the normal remainder is negative.
Parameters:
- divisor: The number to divide by.
Return Value:
An arbitrary-precision integer.
Exceptions:
-
System.ArgumentException: The parameter divisor is less than 0.
-
System.ArgumentNullException: The parameter divisor is null.
public PeterO.Numbers.EInteger ModPow( PeterO.Numbers.EInteger pow, PeterO.Numbers.EInteger mod);
Calculates the remainder when this arbitrary-precision integer raised to a certain power is divided by another arbitrary-precision integer.
Parameters:
-
pow: The power to raise this integer by.
-
mod: The integer to divide the raised number by.
Return Value:
An arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter pow or mod is null.
public static PeterO.Numbers.EInteger ModPow( PeterO.Numbers.EInteger bigintValue, PeterO.Numbers.EInteger pow, PeterO.Numbers.EInteger mod);
Calculates the remainder when an arbitrary-precision integer raised to a certain power is divided by another arbitrary-precision integer.
Parameters:
-
bigintValue: The starting operand.
-
pow: The power to raise this integer by.
-
mod: The integer to divide the raised number by.
Return Value:
The value ( bigintValue ^ pow )% mod .
Exceptions:
- System.ArgumentNullException: The parameter bigintValue is null.
public PeterO.Numbers.EInteger Multiply( int intValue);
Multiplies this arbitrary-precision integer by a 32-bit signed integer and returns the result.
EInteger result = EInteger.FromString("5").Multiply(200);
.
Parameters:
- intValue: The parameter intValue is a 32-bit signed integer.
Return Value:
The product of the two numbers, that is, this arbitrary-precision integer times a 32-bit signed integer.
public PeterO.Numbers.EInteger Multiply( long longValue);
Multiplies this arbitrary-precision integer by a 64-bit signed integer and returns the result.
Parameters:
- longValue: The parameter longValue is a 64-bit signed integer.
Return Value:
The product of the two numbers, that is, this arbitrary-precision integer times a 64-bit signed integer.
public PeterO.Numbers.EInteger Multiply( PeterO.Numbers.EInteger bigintMult);
Multiplies this arbitrary-precision integer by another arbitrary-precision integer and returns the result.
Parameters:
- bigintMult: Another arbitrary-precision integer.
Return Value:
The product of the two numbers, that is, this arbitrary-precision integer times another arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter bigintMult is null.
public PeterO.Numbers.EInteger Negate();
Gets the value of this object with the sign reversed.
Return Value:
This object’s value with the sign reversed.
public PeterO.Numbers.EInteger Not();
Returns an arbitrary-precision integer with every bit flipped from this one (also called an inversion or NOT operation).
Return Value:
An arbitrary-precision integer in which each bit in its two’s complement representation is set if the corresponding bit of this integer is clear, and vice versa. Returns -1 if this integer is 0. If this integer is positive, the return value is negative, and vice versa. This method uses the two’s complement form of negative integers (see "Forms of numbers"“Forms of numbers” ). For example, in binary, NOT 10100 = …11101011 (or in decimal, NOT 20 = -21). In binary, NOT …11100110 = 11001 (or in decimal, NOT -26 = 25).
public static PeterO.Numbers.EInteger Not( PeterO.Numbers.EInteger valueA);
Returns an arbitrary-precision integer with every bit flipped.
Parameters:
- valueA: The operand as an arbitrary-precision integer.
Return Value:
An arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter valueA is null.
public static PeterO.Numbers.EInteger operator +( PeterO.Numbers.EInteger bthis, PeterO.Numbers.EInteger augend);
Adds an arbitrary-precision integer and another arbitrary-precision integer and returns the result.
Parameters:
-
bthis: The first operand.
-
augend: The second operand.
Return Value:
The sum of the two numbers, that is, an arbitrary-precision integer plus another arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter bthis is null.
public static PeterO.Numbers.EInteger operator &( PeterO.Numbers.EInteger thisValue, PeterO.Numbers.EInteger otherValue);
Does an AND operation between two arbitrary-precision integer values. For each bit of the result, that bit is 1 if the corresponding bits of the two operands are both 1, or is 0 otherwise.
Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
-
thisValue: The first operand.
-
otherValue: The second operand.
Return Value:
The result of the operation.
Exceptions:
- System.ArgumentNullException: The parameter “a” or “b” is null.
public static PeterO.Numbers.EInteger operator |( PeterO.Numbers.EInteger thisValue, PeterO.Numbers.EInteger otherValue);
Does an OR operation between two arbitrary-precision integer instances. For each bit of the result, that bit is 1 if either or both of the corresponding bits of the two operands are 1, or is 0 otherwise.
Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
-
thisValue: An arbitrary-precision integer.
-
otherValue: Another arbitrary-precision integer.
Return Value:
The result of the operation.
Exceptions:
- System.ArgumentNullException: The parameter “first” or “second” is null.
public static PeterO.Numbers.EInteger operator --( PeterO.Numbers.EInteger bthis);
Subtracts one from an arbitrary-precision integer.
Parameters:
- bthis: An arbitrary-precision integer.
Return Value:
The given arbitrary-precision integer minus one.
Exceptions:
- System.ArgumentNullException: The parameter bthis is null.
public static PeterO.Numbers.EInteger operator /( PeterO.Numbers.EInteger dividend, PeterO.Numbers.EInteger divisor);
Divides an arbitrary-precision integer by the value of an arbitrary-precision integer object.
Parameters:
-
dividend: The number that will be divided by the divisor.
-
divisor: The number to divide by.
Return Value:
The quotient of the two objects.
Exceptions:
- System.ArgumentNullException: The parameter dividend is null.
public static PeterO.Numbers.EInteger operator ^( PeterO.Numbers.EInteger a, PeterO.Numbers.EInteger b);
Finds the exclusive “or” of two arbitrary-precision integer objects. For each bit of the result, that bit is 1 if either of the corresponding bits of the two operands, but not both, is 1, or is 0 otherwise. Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
-
a: The first arbitrary-precision integer.
-
b: The second arbitrary-precision integer.
Return Value:
An arbitrary-precision integer in which each bit is set if it’s set in one input integer but not the other.
Exceptions:
- System.ArgumentNullException: The parameter a or b is null.
public static explicit operator byte( PeterO.Numbers.EInteger input);
Converts an arbitrary-precision integer to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255).
Parameters:
- input: The number to convert as an arbitrary-precision integer.
Return Value:
The value of input as a byte (from 0 to 255).
Exceptions:
-
System.OverflowException: The parameter input is less than 0 or greater than 255.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator int( PeterO.Numbers.EInteger input);
Converts an arbitrary-precision integer to a 32-bit signed integer if it can fit in a 32-bit signed integer.
Parameters:
- input: The number to convert as an arbitrary-precision integer.
Return Value:
The value of input as a 32-bit signed integer.
Exceptions:
-
System.OverflowException: The parameter input is less than -2147483648 or greater than 2147483647.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator long( PeterO.Numbers.EInteger input);
Converts an arbitrary-precision integer to a 64-bit signed integer if it can fit in a 64-bit signed integer.
Parameters:
- input: The number to convert as an arbitrary-precision integer.
Return Value:
The value of input as a 64-bit signed integer.
Exceptions:
-
System.OverflowException: The parameter input is less than -9223372036854775808 or greater than 9223372036854775807.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator PeterO.Numbers.EInteger( bool boolValue);
Converts a byte (from 0 to 255) to an arbitrary-precision integer.
Parameters:
- boolValue: Either
true
orfalse
.
Return Value:
The value of boolValue as an arbitrary-precision integer.
public static explicit operator sbyte( PeterO.Numbers.EInteger input);
This API is not CLS-compliant.
Converts an arbitrary-precision integer to an 8-bit signed integer if it can fit in an 8-bit signed integer.
Parameters:
- input: The number to convert as an arbitrary-precision integer.
Return Value:
The value of input as an 8-bit signed integer.
Exceptions:
-
System.OverflowException: The parameter input is less than -128 or greater than 127.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator short( PeterO.Numbers.EInteger input);
Converts an arbitrary-precision integer to a 16-bit signed integer if it can fit in a 16-bit signed integer.
Parameters:
- input: The number to convert as an arbitrary-precision integer.
Return Value:
The value of input as a 16-bit signed integer.
Exceptions:
-
System.OverflowException: The parameter input is less than -32768 or greater than 32767.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator uint( PeterO.Numbers.EInteger input);
This API is not CLS-compliant.
Converts an arbitrary-precision integer to a 32-bit signed integer if it can fit in a 32-bit signed integer.
Parameters:
- input: The number to convert as an arbitrary-precision integer.
Return Value:
The value of input as a 32-bit signed integer.
Exceptions:
-
System.OverflowException: The parameter input is less than 0 or greater than 4294967295.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator ulong( PeterO.Numbers.EInteger input);
This API is not CLS-compliant.
Converts an arbitrary-precision integer to a 64-bit unsigned integer if it can fit in a 64-bit unsigned integer.
Parameters:
- input: The number to convert as an arbitrary-precision integer.
Return Value:
The value of input as a 64-bit unsigned integer.
Exceptions:
-
System.OverflowException: The parameter input is less than 0 or greater than 18446744073709551615.
-
System.ArgumentNullException: The parameter input is null.
public static explicit operator ushort( PeterO.Numbers.EInteger input);
This API is not CLS-compliant.
Converts an arbitrary-precision integer to a 16-bit unsigned integer if it can fit in a 16-bit unsigned integer.
Parameters:
- input: The number to convert as an arbitrary-precision integer.
Return Value:
The value of input as a 16-bit unsigned integer.
Exceptions:
-
System.OverflowException: The parameter input is less than 0 or greater than 65535.
-
System.ArgumentNullException: The parameter input is null.
public static bool operator >( PeterO.Numbers.EInteger thisValue, PeterO.Numbers.EInteger otherValue);
Determines whether an arbitrary-precision integer is greater than another arbitrary-precision integer.
Parameters:
-
thisValue: The first arbitrary-precision integer.
-
otherValue: The second arbitrary-precision integer.
Return Value:
true
if thisValue
is greater than otherValue
; otherwise, false
.
public static bool operator >=( PeterO.Numbers.EInteger thisValue, PeterO.Numbers.EInteger otherValue);
Determines whether an arbitrary-precision integer value is greater than another arbitrary-precision integer.
Parameters:
-
thisValue: The first arbitrary-precision integer.
-
otherValue: The second arbitrary-precision integer.
Return Value:
true
if thisValue
is at least otherValue
; otherwise, false
.
public static implicit operator PeterO.Numbers.EInteger( byte inputByte);
Converts a byte (from 0 to 255) to an arbitrary-precision integer.
Parameters:
- inputByte: The number to convert as a byte (from 0 to 255).
Return Value:
The value of inputByte as an arbitrary-precision integer.
public static implicit operator PeterO.Numbers.EInteger( int inputInt32);
Converts a 32-bit signed integer to an arbitrary-precision integer.
Parameters:
- inputInt32: The number to convert as a 32-bit signed integer.
Return Value:
The value of inputInt32 as an arbitrary-precision integer.
public static implicit operator PeterO.Numbers.EInteger( long inputInt64);
Converts a 64-bit signed integer to an arbitrary-precision integer.
Parameters:
- inputInt64: The number to convert as a 64-bit signed integer.
Return Value:
The value of inputInt64 as an arbitrary-precision integer.
public static implicit operator PeterO.Numbers.EInteger( sbyte inputSByte);
This API is not CLS-compliant.
Converts an 8-bit signed integer to an arbitrary-precision integer.
Parameters:
- inputSByte: The number to convert as an 8-bit signed integer.
Return Value:
The value of inputSByte as an arbitrary-precision integer.
public static implicit operator PeterO.Numbers.EInteger( short inputInt16);
Converts a 16-bit signed integer to an arbitrary-precision integer.
Parameters:
- inputInt16: The number to convert as a 16-bit signed integer.
Return Value:
The value of inputInt16 as an arbitrary-precision integer.
public static implicit operator PeterO.Numbers.EInteger( uint inputUInt32);
This API is not CLS-compliant.
Converts a 32-bit signed integer to an arbitrary-precision integer.
Parameters:
- inputUInt32: The number to convert as a 32-bit signed integer.
Return Value:
The value of inputUInt32 as an arbitrary-precision integer.
public static implicit operator PeterO.Numbers.EInteger( ulong inputUInt64);
This API is not CLS-compliant.
Converts a 64-bit unsigned integer to an arbitrary-precision integer.
Parameters:
- inputUInt64: The number to convert as a 64-bit unsigned integer.
Return Value:
The value of inputUInt64 as an arbitrary-precision integer.
public static implicit operator PeterO.Numbers.EInteger( ushort inputUInt16);
This API is not CLS-compliant.
Converts a 16-bit unsigned integer to an arbitrary-precision integer.
Parameters:
- inputUInt16: The number to convert as a 16-bit unsigned integer.
Return Value:
The value of inputUInt16 as an arbitrary-precision integer.
public static PeterO.Numbers.EInteger operator ++( PeterO.Numbers.EInteger bthis);
Adds one to an arbitrary-precision integer.
Parameters:
- bthis: An arbitrary-precision integer.
Return Value:
The given arbitrary-precision integer plus one.
Exceptions:
- System.ArgumentNullException: The parameter bthis is null.
public static PeterO.Numbers.EInteger operator <<( PeterO.Numbers.EInteger bthis, int bitCount);
Returns an arbitrary-precision integer with the bits shifted to the left by a number of bits. A value of 1 doubles this value, a value of 2 multiplies it by 4, a value of 3 × by, a value of 4 × by, and so on.
Parameters:
-
bthis: The arbitrary-precision integer to shift left.
-
bitCount: The number of bits to shift. Can be negative, in which case this is the same as shiftRight with the absolute value of this parameter.
Return Value:
An arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter bthis is null.
public static bool operator <( PeterO.Numbers.EInteger thisValue, PeterO.Numbers.EInteger otherValue);
Determines whether an arbitrary-precision integer is less than another arbitrary-precision integer.
Parameters:
-
thisValue: The first arbitrary-precision integer.
-
otherValue: The second arbitrary-precision integer.
Return Value:
true
if thisValue
is less than otherValue
; otherwise, false
.
public static bool operator <=( PeterO.Numbers.EInteger thisValue, PeterO.Numbers.EInteger otherValue);
Determines whether an arbitrary-precision integer is up to another arbitrary-precision integer.
Parameters:
-
thisValue: The first arbitrary-precision integer.
-
otherValue: The second arbitrary-precision integer.
Return Value:
true
if thisValue
is up to otherValue
; otherwise, false
.
public static PeterO.Numbers.EInteger operator %( PeterO.Numbers.EInteger dividend, PeterO.Numbers.EInteger divisor);
Returns the remainder that would result when an arbitrary-precision integer is divided by another arbitrary-precision integer. The remainder is the number that remains when the absolute value of an arbitrary-precision integer is divided by the absolute value of the other arbitrary-precision integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
Parameters:
-
dividend: The first operand.
-
divisor: The number to divide by.
Return Value:
The remainder that would result when an arbitrary-precision integer is divided by another arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter dividend is null.
public static PeterO.Numbers.EInteger operator *( PeterO.Numbers.EInteger operand1, PeterO.Numbers.EInteger operand2);
Multiplies an arbitrary-precision integer by another arbitrary-precision integer and returns the result.
Parameters:
-
operand1: The first operand.
-
operand2: The second operand.
Return Value:
The product of the two numbers, that is, an arbitrary-precision integer times another arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter operand1 is null.
public static PeterO.Numbers.EInteger operator ~( PeterO.Numbers.EInteger thisValue);
Returns an arbitrary-precision integer with every bit flipped.
Parameters:
- thisValue: The operand as an arbitrary-precision integer.
Return Value:
An arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter thisValue is null.
public static PeterO.Numbers.EInteger operator >>( PeterO.Numbers.EInteger bthis, int smallValue);
Shifts the bits of an arbitrary-precision integer to the right.
For this operation, the arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ). Thus, for negative values, the arbitrary-precision integer is sign-extended.
Parameters:
-
bthis: Another arbitrary-precision integer.
-
smallValue: The parameter smallValue is a 32-bit signed integer.
Return Value:
An arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter bthis is null.
public static PeterO.Numbers.EInteger operator -( PeterO.Numbers.EInteger bthis, PeterO.Numbers.EInteger subtrahend);
Subtracts two arbitrary-precision integer values.
Parameters:
-
bthis: An arbitrary-precision integer.
-
subtrahend: Another arbitrary-precision integer.
Return Value:
The difference of the two objects.
Exceptions:
- System.ArgumentNullException: The parameter bthis is null.
public static PeterO.Numbers.EInteger operator -( PeterO.Numbers.EInteger bigValue);
Negates an arbitrary-precision integer.
Parameters:
- bigValue: An arbitrary-precision integer to negate.
Return Value:
An arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter bigValue is null.
public PeterO.Numbers.EInteger Or( PeterO.Numbers.EInteger second);
Does an OR operation between this arbitrary-precision integer and another one.
Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
- second: Another arbitrary-precision integer that participates in the operation.
Return Value:
An arbitrary-precision integer in which each bit is set if the corresponding bit of this integer is set, the other integer’s corresponding bit is set, or both. For example, in binary, 10110 OR 11010 = 11110 (or in decimal, 22 OR 26 = 30). This method uses the two’s complement form of negative integers (see "Forms of numbers"“Forms of numbers” ). For example, in binary, …11101110 OR 01011 = …11101111 (or in decimal, -18 OR 11 = -17).
Exceptions:
- System.ArgumentNullException: The parameter second is null.
public static PeterO.Numbers.EInteger Or( PeterO.Numbers.EInteger first, PeterO.Numbers.EInteger second);
Does an OR operation between two arbitrary-precision integer instances.
Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
-
first: The first operand.
-
second: The second operand.
Return Value:
An arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter first or second is null.
public PeterO.Numbers.EInteger OrNot( PeterO.Numbers.EInteger second);
Does an OR NOT operation between this arbitrary-precision integer and another one.
Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
- second: Another arbitrary-precision integer that participates in the operation.
Return Value:
An arbitrary-precision integer in which each bit is set if the corresponding bit of this integer is set, the other integer’s corresponding bit is not set, or both. For example, in binary, 10110 OR NOT 11010 = 00100 (or in decimal, 22 OR NOT 26 = 23). This method uses the two’s complement form of negative integers (see "Forms of numbers"“Forms of numbers” ). For example, in binary, …11101110 OR NOT 01011 = …11111110 (or in decimal, -18 OR 11 = -2).
Exceptions:
- System.ArgumentNullException: The parameter second is null.
public PeterO.Numbers.EInteger Pow( int powerSmall);
Raises an arbitrary-precision integer to a power.
Parameters:
- powerSmall: The exponent to raise this integer to.
Return Value:
The result. Returns 1 if powerSmall is 0.
public PeterO.Numbers.EInteger Pow( long longPower);
Raises an arbitrary-precision integer to a power.
Parameters:
- longPower: The exponent to raise this integer to.
Return Value:
The result. Returns 1 if longPower is 0.
Exceptions:
- System.ArgumentException: BigPower is negative.
public PeterO.Numbers.EInteger Pow( PeterO.Numbers.EInteger bigPower);
Raises an arbitrary-precision integer to a power.
Parameters:
- bigPower: The exponent to raise this integer to.
Return Value:
The result. Returns 1 if bigPower is 0.
Exceptions:
-
System.ArgumentNullException: The parameter bigPower is null.
-
System.ArgumentException: BigPower is negative.
public PeterO.Numbers.EInteger PowBigIntVar( PeterO.Numbers.EInteger power);
Obsolete. Use Pow instead.
Raises an arbitrary-precision integer to a power, which is given as another arbitrary-precision integer.
Parameters:
- power: The exponent to raise to.
Return Value:
The result. Returns 1 if power is 0.
Exceptions:
-
System.ArgumentException: The parameter power is less than 0.
-
System.ArgumentNullException: The parameter power is null.
public PeterO.Numbers.EInteger Remainder( int intValue);
Returns the remainder that would result when this arbitrary-precision integer is divided by a 32-bit signed integer. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other 32-bit signed integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
Parameters:
- intValue: The parameter intValue is a 32-bit signed integer.
Return Value:
The remainder that would result when this arbitrary-precision integer is divided by a 32-bit signed integer.
Exceptions:
-
System.DivideByZeroException: Attempted to divide by zero.
-
System.ArgumentNullException: The parameter intValue is null.
public PeterO.Numbers.EInteger Remainder( long longValue);
Returns the remainder that would result when this arbitrary-precision integer is divided by a 64-bit signed integer. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other 64-bit signed integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
Parameters:
- longValue: The parameter longValue is a 64-bit signed integer.
Return Value:
The remainder that would result when this arbitrary-precision integer is divided by a 64-bit signed integer.
public PeterO.Numbers.EInteger Remainder( PeterO.Numbers.EInteger divisor);
Returns the remainder that would result when this arbitrary-precision integer is divided by another arbitrary-precision integer. The remainder is the number that remains when the absolute value of this arbitrary-precision integer is divided by the absolute value of the other arbitrary-precision integer; the remainder has the same sign (positive or negative) as this arbitrary-precision integer.
Parameters:
- divisor: The number to divide by.
Return Value:
The remainder that would result when this arbitrary-precision integer is divided by another arbitrary-precision integer.
Exceptions:
-
System.DivideByZeroException: Attempted to divide by zero.
-
System.ArgumentNullException: The parameter divisor is null.
public PeterO.Numbers.EInteger Root( int root);
Finds the nth root of this instance’s value, rounded down.
Parameters:
- root: The root to find; must be 1 or greater. If this value is 2, this method finds the square root; if 3, the cube root, and in general, if N, the N-th root.
Return Value:
The square root of this object’s value. Returns 0 if this value is 0 or less.
public PeterO.Numbers.EInteger Root( PeterO.Numbers.EInteger root);
Finds the nth root of this instance’s value, rounded down.
Parameters:
- root: The root to find; must be 1 or greater. If this value is 2, this method finds the square root; if 3, the cube root, and in general, if N, the N-th root.
Return Value:
The square root of this object’s value. Returns 0 if this value is 0 or less.
Exceptions:
- System.ArgumentNullException: The parameter root is null.
public PeterO.Numbers.EInteger[] RootRem( int root);
Calculates the nth root and the remainder.
Parameters:
- root: The root to find; must be 1 or greater. If this value is 2, this method finds the square root; if 3, the cube root, and in general, if N, the N-th root.
Return Value:
An array of two arbitrary-precision integers: the first integer is the nth root, and the second is the difference between this value and the nth power of the first integer. Returns two zeros if this value is 0 or less, or one and zero if this value equals 1.
public PeterO.Numbers.EInteger[] RootRem( PeterO.Numbers.EInteger root);
Calculates the nth root and the remainder.
Parameters:
- root: The root to find; must be 1 or greater. If this value is 2, this method finds the square root; if 3, the cube root, and in general, if N, the N-th root.
Return Value:
An array of two arbitrary-precision integers: the first integer is the nth root, and the second is the difference between this value and the nth power of the first integer. Returns two zeros if this value is 0 or less, or one and zero if this value equals 1.
Exceptions:
- System.ArgumentNullException: The parameter root is null.
public PeterO.Numbers.EInteger ShiftLeft( int numberBits);
Returns an arbitrary-precision integer with the bits shifted to the left by a number of bits. A value of 1 doubles this value, a value of 2 multiplies it by 4, a value of 3, by 8, a value of 4, by 16, and in general, a value of N, by 2^N, where N is 1 or greater.
Parameters:
- numberBits: The number of bits to shift. Can be negative, in which case this is the same as shiftRight with the absolute value of this parameter.
Return Value:
An arbitrary-precision integer.
public PeterO.Numbers.EInteger ShiftLeft( PeterO.Numbers.EInteger eshift);
Returns an arbitrary-precision integer with the bits shifted to the left by a number of bits given as an arbitrary-precision integer. A value of 1 doubles this value, a value of 2 multiplies it by 4; a value of 3, by 8; a value of 4, by 16; and in general, a value of N, by 2^N, where N is 1 or greater.
Parameters:
- eshift: The number of bits to shift. Can be negative, in which case this is the same as ShiftRight with the absolute value of this parameter.
Return Value:
An arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter eshift is null.
public PeterO.Numbers.EInteger ShiftRight( int numberBits);
Returns an arbitrary-precision integer with the bits shifted to the right. For this operation, the arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ). Thus, for negative values, the arbitrary-precision integer is sign-extended.
Parameters:
- numberBits: The number of bits to shift. Can be negative, in which case this is the same as shiftLeft with the absolute value of this parameter.
Return Value:
An arbitrary-precision integer.
public PeterO.Numbers.EInteger ShiftRight( PeterO.Numbers.EInteger eshift);
Returns an arbitrary-precision integer with the bits shifted to the right. For this operation, the arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ). Thus, for negative values, the arbitrary-precision integer is sign-extended.
Parameters:
- eshift: The number of bits to shift. Can be negative, in which case this is the same as ShiftLeft with the absolute value of this parameter.
Return Value:
An arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter eshift is null.
public PeterO.Numbers.EInteger Sqrt();
Finds the square root of this instance’s value, rounded down.
Return Value:
The square root of this object’s value. Returns 0 if this value is 0 or less.
public PeterO.Numbers.EInteger[] SqrtRem();
Calculates the square root and the remainder.
Return Value:
An array of two arbitrary-precision integers: the first integer is the square root, and the second is the difference between this value and the square of the first integer. Returns two zeros if this value is 0 or less, or one and zero if this value equals 1.
public PeterO.Numbers.EInteger Subtract( int intValue);
Subtracts a 32-bit signed integer from this arbitrary-precision integer and returns the result.
Parameters:
- intValue: The parameter intValue is a 32-bit signed integer.
Return Value:
The difference between the two numbers, that is, this arbitrary-precision integer minus a 32-bit signed integer.
public PeterO.Numbers.EInteger Subtract( long longValue);
Subtracts a 64-bit signed integer from this arbitrary-precision integer and returns the result.
Parameters:
- longValue: The parameter longValue is a 64-bit signed integer.
Return Value:
The difference between the two numbers, that is, this arbitrary-precision integer minus a 64-bit signed integer.
public PeterO.Numbers.EInteger Subtract( PeterO.Numbers.EInteger subtrahend);
Subtracts an arbitrary-precision integer from this arbitrary-precision integer and returns the result.
Parameters:
- subtrahend: Another arbitrary-precision integer.
Return Value:
The difference between the two numbers, that is, this arbitrary-precision integer minus another arbitrary-precision integer.
Exceptions:
- System.ArgumentNullException: The parameter subtrahend is null.
public byte ToByteChecked();
Converts this number’s value to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255).
Return Value:
This number’s value as a byte (from 0 to 255).
Exceptions:
- System.OverflowException: This value is less than 0 or greater than 255.
public byte[] ToBytes( bool littleEndian);
Returns a byte array of this integer’s value. The byte array will take the number’s two’s-complement form (see "Forms of numbers"“Forms of numbers” ), using the fewest bytes necessary to store its value unambiguously. If this value is negative, the bits that appear beyond the most significant bit of the number will be all ones. The resulting byte array can be passed to the FromBytes()
method (with the same byte order) to reconstruct this integer’s value.
Parameters:
- littleEndian: See the ‘littleEndian’ parameter of the
FromBytes()
method.
Return Value:
A byte array. If this value is 0, returns a byte array with the single element 0.
public byte ToByteUnchecked();
Converts this number to a byte (from 0 to 255), returning the least-significant bits of this number’s two’s-complement form.
Return Value:
This number, converted to a byte (from 0 to 255).
public short ToInt16Checked();
Converts this number’s value to a 16-bit signed integer if it can fit in a 16-bit signed integer.
Return Value:
This number’s value as a 16-bit signed integer.
Exceptions:
- System.OverflowException: This value is less than -32768 or greater than 32767.
public short ToInt16Unchecked();
Converts this number to a 16-bit signed integer, returning the least-significant bits of this number’s two’s-complement form.
Return Value:
This number, converted to a 16-bit signed integer.
public int ToInt32Checked();
Converts this object’s value to a 32-bit signed integer, throwing an exception if it can’t fit.
Return Value:
A 32-bit signed integer.
Exceptions:
- T:System.OverflowException: This object’s value is too big to fit a 32-bit signed integer.
public int ToInt32Unchecked();
Converts this object’s value to a 32-bit signed integer. If the value can’t fit in a 32-bit integer, returns the lower 32 bits of this object’s two’s-complement form (see "Forms of numbers"“Forms of numbers” ) (in which case the return value might have a different sign than this object’s value).
Return Value:
A 32-bit signed integer.
public long ToInt64Checked();
Converts this object’s value to a 64-bit signed integer, throwing an exception if it can’t fit.
Return Value:
A 64-bit signed integer.
Exceptions:
- T:System.OverflowException: This object’s value is too big to fit a 64-bit signed integer.
public long ToInt64Unchecked();
Converts this object’s value to a 64-bit signed integer. If the value can’t fit in a 64-bit integer, returns the lower 64 bits of this object’s two’s-complement form (see "Forms of numbers"“Forms of numbers” ) (in which case the return value might have a different sign than this object’s value).
Return Value:
A 64-bit signed integer.
public string ToRadixString( int radix);
Generates a string representing the value of this object, in the specified radix.
Parameters:
- radix: A radix from 2 through 36. For example, to generate a hexadecimal (base-16) string, specify 16. To generate a decimal (base-10) string, specify 10.
Return Value:
A string representing the value of this object. If this value is 0, returns “0”. If negative, the string will begin with a minus sign (“-“, U+002D). Depending on the radix, the string will use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic uppercase letters A to Z (U+0041 to U+005A). For example, 0-9 in radix 10, and 0-9, then A-F in radix 16.
public sbyte ToSByteChecked();
This API is not CLS-compliant.
Converts this number’s value to an 8-bit signed integer if it can fit in an 8-bit signed integer.
Return Value:
This number’s value as an 8-bit signed integer.
Exceptions:
- System.OverflowException: This value is less than -128 or greater than 127.
public sbyte ToSByteUnchecked();
This API is not CLS-compliant.
Converts this number to an 8-bit signed integer, returning the least-significant bits of this number’s two’s-complement form.
Return Value:
This number, converted to an 8-bit signed integer.
public override string ToString();
Converts this object to a text string in base 10.
Return Value:
A string representation of this object. If this value is 0, returns “0”. If negative, the string will begin with a minus sign (“-“, U+002D). The string will use the basic digits 0 to 9 (U+0030 to U+0039).
public ushort ToUInt16Checked();
This API is not CLS-compliant.
Converts this number’s value to a 16-bit unsigned integer if it can fit in a 16-bit unsigned integer.
Return Value:
This number’s value as a 16-bit unsigned integer.
Exceptions:
- System.OverflowException: This value is less than 0 or greater than 65535.
public ushort ToUInt16Unchecked();
This API is not CLS-compliant.
Converts this number to a 16-bit unsigned integer, returning the least-significant bits of this number’s two’s-complement form.
Return Value:
This number, converted to a 16-bit unsigned integer.
public uint ToUInt32Checked();
This API is not CLS-compliant.
Converts this number’s value to a 32-bit signed integer if it can fit in a 32-bit signed integer.
Return Value:
This number’s value as a 32-bit signed integer.
Exceptions:
- System.OverflowException: This value is less than 0 or greater than 4294967295.
public uint ToUInt32Unchecked();
This API is not CLS-compliant.
Converts this number to a 32-bit signed integer, returning the least-significant bits of this number’s two’s-complement form.
Return Value:
This number, converted to a 32-bit signed integer.
public ulong ToUInt64Checked();
This API is not CLS-compliant.
Converts this number’s value to a 64-bit signed integer if it can fit in a 64-bit signed integer.
Return Value:
This number’s value as a 64-bit signed integer.
Exceptions:
- System.OverflowException: This value is outside the range of a 64-bit signed integer.
public ulong ToUInt64Unchecked();
This API is not CLS-compliant.
Converts this number to a 64-bit signed integer, returning the least-significant bits of this number’s two’s-complement form.
Return Value:
This number, converted to a 64-bit signed integer.
public PeterO.Numbers.EInteger Xor( PeterO.Numbers.EInteger other);
Does an exclusive OR (XOR) operation between this arbitrary-precision integer and another one.
Parameters:
- other: Another arbitrary-precision integer that participates in the operation.
Return Value:
An arbitrary-precision integer in which each bit is set if the corresponding bit is set in one input integer but not in the other. For example, in binary, 11010 XOR 01001 = 10011 (or in decimal, 26 XOR 9 = 19). This method uses the two’s complement form of negative integers (see "Forms of numbers"“Forms of numbers” ). For example, in binary, …11101101 XOR 00011 = …11101110 (or in decimal, -19 XOR 3 = -18).
Exceptions:
- System.ArgumentNullException: The parameter other is null.
public static PeterO.Numbers.EInteger Xor( PeterO.Numbers.EInteger a, PeterO.Numbers.EInteger b);
Finds the exclusive “or” of two arbitrary-precision integer objects. Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
-
a: The first arbitrary-precision integer.
-
b: The second arbitrary-precision integer.
Return Value:
An arbitrary-precision integer in which each bit is set if the corresponding bit is set in one input integer but not in the other.
Exceptions:
- System.ArgumentNullException: The parameter a or b is null.
public PeterO.Numbers.EInteger XorNot( PeterO.Numbers.EInteger second);
Does an XOR NOT operation (or equivalence operation, EQV operation, or exclusive-OR NOT operation) between this arbitrary-precision integer and another one.
Each arbitrary-precision integer is treated as a two’s-complement form (see "Forms of numbers"“Forms of numbers” ) for the purposes of this operator.
Parameters:
- second: Another arbitrary-precision integer that participates in the operation.
Return Value:
An arbitrary-precision integer in which each bit is set if the corresponding bit of this integer is set or the other integer’s corresponding bit is not set, but not both. For example, in binary, 10110 XOR NOT 11010 = 10011 (or in decimal, 22 XOR NOT 26 = 19). This method uses the two’s complement form of negative integers (see "Forms of numbers"“Forms of numbers” ). For example, in binary, …11101110 XOR NOT 01011 = …11111010 (or in decimal, -18 OR 11 = -6).
Exceptions:
- System.ArgumentNullException: The parameter second is null.