Skip to content

Latest commit

 

History

History
77 lines (72 loc) · 14.2 KB

BigInt.md

File metadata and controls

77 lines (72 loc) · 14.2 KB

BigInt Struct

Encapsulates an arbitrary-size integer.

public struct BigInt :
System.IComparable<KeepCoding.BigInt>,
System.IEquatable<KeepCoding.BigInt>

Implements System.IComparable<BigInt>, System.IEquatable<BigInt>

Remarks

This struct has been written by Timwi. https://github.com/Timwi/

Constructors
BigInt(int) Constructs a BigInt from a 32-bit signed integer.
BigInt(long) Constructs a BigInt from a 64-bit signed integer.
BigInt(uint) Constructs a BigInt from a 32-bit signed integer.
BigInt(ulong) Constructs a BigInt from a 64-bit unsigned integer.
Properties
AbsoluteValue Returns the absolute value.
Inverse Returns the bitwise inverse (bitwise NOT).
IsZero Determines whether the integer is 0.
MostSignificantBit Returns the bit-index of the most significant bit in this number. If the number is positive, this is the index of the most significant ‘1’ bit. If the number is negative, it is the index of the most significant ‘0’ bit. If the number is zero, the result is -1.
Negative Returns the negative value.
Sign Returns the sign of the number: −1 for negative numbers, 0 for zero, and 1 for positive numbers.
Methods
Add(BigInt) Returns the sum of this integer plus other.
CompareTo(BigInt) Compares this integer to other.
Divide(BigInt) Returns the quotient obtained by dividing this integer by other.
DivideModulo(BigInt) Calculates a quotient and remainder by dividing this integer by other.
Equals(BigInt) Equality comparison.
Equals(object) Equality comparison.
GetBit(int) Returns whether the bit at index is 1 (regardless of the integer’s sign).
GetHashCode() Hash code function.
Modulo(BigInt) Returns the remainder obtained when dividing this integer by other.
Multiply(BigInt) Returns the product of this integer times other.
Parse(string) Parses a numerical string (consisting only of digits 0 to 9, optionally prepended with a -) into a BigInt.
ToString() Override; see base.
TryParse(string, BigInt) Parses a numerical string (consisting only of digits 0 to 9, optionally prepended with a -) into a BigInt.
Operators
operator +(BigInt, BigInt) Returns the sum of one plus two.
operator &(BigInt, BigInt) Bitwise and operator.
[operator (BigInt, BigInt)](BigInt.op_BitwiseOr.pKMpwzupbk3ah4S4S6wDBg.md 'KeepCoding.BigInt.op_BitwiseOr(KeepCoding.BigInt, KeepCoding.BigInt)')
operator --(BigInt) Decrement operator.
operator /(BigInt, BigInt) Returns the quotient obtained by dividing one by two.
operator ==(BigInt, BigInt) Equality comparison operator.
operator ^(BigInt, BigInt) Bitwise xor operator.
operator >(BigInt, BigInt) Greater-than comparison operator.
operator >=(BigInt, BigInt) Greater-than-or-equal-to comparison operator.
implicit operator BigInt(byte) Constructs a BigInt from an 8-bit unsigned integer.
implicit operator BigInt(int) Constructs a BigInt from a 32-bit signed integer.
implicit operator BigInt(long) Constructs a BigInt from a 64-bit signed integer.
implicit operator BigInt(sbyte) Constructs a BigInt from an 8-bit signed integer.
implicit operator BigInt(short) Constructs a BigInt from a 16-bit unsigned integer.
implicit operator BigInt(uint) Constructs a BigInt from a 32-bit unsigned integer.
implicit operator BigInt(ulong) Constructs a BigInt from a 64-bit unsigned integer.
implicit operator BigInt(ushort) Constructs a BigInt from a 16-bit signed integer.
operator ++(BigInt) Increment operator.
operator !=(BigInt, BigInt) Inequality comparison operator.
operator <<(BigInt, int) Returns the result of a bit-shift-left by the specified amount. This is equivalent to multiply by 2 to the power of amount.
operator <(BigInt, BigInt) Less-than comparison operator.
operator <=(BigInt, BigInt) Less-than-or-equal-to comparison operator.
operator %(BigInt, BigInt) Returns the remainder obtained when dividing one by two.
operator *(BigInt, BigInt) Returns the product of one times two.
operator ~(BigInt) Returns the bitwise inverse (bitwise NOT).
operator >>(BigInt, int) Returns the result of a bit-shift-right by the specified amount. This is equivalent to dividing by 2 to the power of amount and rounding down.
operator -(BigInt, BigInt) Returns the difference of one minus two.
operator -(BigInt) Returns the negative value.
operator +(BigInt) Returns the operand.