C# Class Jurassic.BigInteger

Represents an arbitrarily large signed integer.
显示文件 Open project: paulbartrum/jurassic Class Usage Examples

Public Properties

Property Type Description
One BigInteger
Zero BigInteger

Public Methods

Method Description
Abs ( BigInteger b ) : BigInteger

Gets the absolute value of a BigInteger object.

Add ( BigInteger left, BigInteger right ) : BigInteger

Adds two BigInteger values and returns the result.

BigInteger ( int value ) : System

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

BigInteger ( long value ) : System

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

Compare ( BigInteger a, BigInteger b ) : int

Returns -1 if a < b, 0 if they are the same, or 1 if a > b.

Equals ( object obj ) : bool

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

FromDouble ( double value ) : BigInteger

Returns a new instance BigInteger structure from a 64-bit double precision floating point value.

GetHashCode ( ) : int

Returns the hash code for the current BigInteger object.

InPlaceDecrement ( ) : void

Decrements the current value of the BigInteger object.

LeftShift ( BigInteger value, int shift ) : BigInteger

Shifts a BigInteger value a specified number of bits to the left.

Log ( BigInteger value, double baseValue ) : double

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

Multiply ( BigInteger left, BigInteger right ) : BigInteger

Returns the product of two BigInteger values.

MultiplyAdd ( BigInteger b, int m, int a ) : BigInteger

Multiply by m and add a.

MultiplyPow5 ( BigInteger b, int k ) : BigInteger

Computes b x 5 ^ k.

Negate ( BigInteger value ) : BigInteger

Negates a specified BigInteger value.

Parse ( string str ) : BigInteger

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

Pow ( int radix, int exponent ) : BigInteger

Equivalent to BigInteger.Pow but with integer arguments.

Quorem ( BigInteger &dividend, BigInteger divisor ) : int

Calculates the integer result of dividing dividend by divisor then sets dividend to the remainder.

RightShift ( BigInteger value, int shift ) : BigInteger

Shifts a BigInteger value a specified number of bits to the right.

Note: unlike System.Numerics.BigInteger, negative numbers are treated identically to positive numbers.

SetupQuorum ( BigInteger &dividend, BigInteger &divisor ) : void

Modifies the given values so they are suitable for passing to Quorem.

SetupQuorum ( BigInteger &dividend, BigInteger &divisor, BigInteger &other ) : void

Modifies the given values so they are suitable for passing to Quorem.

Subtract ( BigInteger left, BigInteger right ) : BigInteger

Subtracts one BigInteger value from another and returns the result.

ToDouble ( ) : double

Returns a double that corresponds to the BigInteger value.

ToString ( ) : string

Converts the numeric value of the current BigInteger object to its equivalent string representation.

Private Methods

Method Description
BigInteger ( uint bits, int wordCount, int sign ) : System
CountLeadingZeroBits ( uint value ) : int

Returns the number of leading zero bits in the given 32-bit integer.

Method Details

Abs() public static method

Gets the absolute value of a BigInteger object.
public static Abs ( BigInteger b ) : BigInteger
b BigInteger A number.
return BigInteger

Add() public static method

Adds two BigInteger values and returns the result.
public static Add ( BigInteger left, BigInteger right ) : BigInteger
left BigInteger The first value to add.
right BigInteger The second value to add.
return BigInteger

BigInteger() public method

Initializes a new instance of the BigInteger structure using a 32-bit signed integer value.
public BigInteger ( int value ) : System
value int A 32-bit signed integer.
return System

BigInteger() public method

Initializes a new instance of the BigInteger structure using a 64-bit signed integer value.
public BigInteger ( long value ) : System
value long A 64-bit signed integer.
return System

Compare() public static method

Returns -1 if a < b, 0 if they are the same, or 1 if a > b.
public static Compare ( BigInteger a, BigInteger b ) : int
a BigInteger
b BigInteger
return int

Equals() public method

Returns a value that indicates whether the current instance and a specified BigInteger object have the same value.
public Equals ( object obj ) : bool
obj object The object to compare.
return bool

FromDouble() public static method

Returns a new instance BigInteger structure from a 64-bit double precision floating point value.
public static FromDouble ( double value ) : BigInteger
value double A 64-bit double precision floating point value.
return BigInteger

GetHashCode() public method

Returns the hash code for the current BigInteger object.
public GetHashCode ( ) : int
return int

InPlaceDecrement() public method

Decrements the current value of the BigInteger object.
public InPlaceDecrement ( ) : void
return void

LeftShift() public static method

Shifts a BigInteger value a specified number of bits to the left.
public static LeftShift ( BigInteger value, int shift ) : BigInteger
value BigInteger The value whose bits are to be shifted.
shift int The number of bits to shift to the left. /// Can be negative to shift to the right.
return BigInteger

Log() public static method

Returns the logarithm of a specified number in a specified base.
public static Log ( BigInteger value, double baseValue ) : double
value BigInteger A number whose logarithm is to be found.
baseValue double The base of the logarithm.
return double

Multiply() public static method

Returns the product of two BigInteger values.
public static Multiply ( BigInteger left, BigInteger right ) : BigInteger
left BigInteger The first number to multiply.
right BigInteger The second number to multiply.
return BigInteger

MultiplyAdd() public static method

Multiply by m and add a.
public static MultiplyAdd ( BigInteger b, int m, int a ) : BigInteger
b BigInteger
m int
a int
return BigInteger

MultiplyPow5() public static method

Computes b x 5 ^ k.
public static MultiplyPow5 ( BigInteger b, int k ) : BigInteger
b BigInteger
k int
return BigInteger

Negate() public static method

Negates a specified BigInteger value.
public static Negate ( BigInteger value ) : BigInteger
value BigInteger The value to negate.
return BigInteger

Parse() public static method

Converts the string representation of a number to its BigInteger equivalent.
public static Parse ( string str ) : BigInteger
str string A string that contains the number to convert.
return BigInteger

Pow() public static method

Equivalent to BigInteger.Pow but with integer arguments.
public static Pow ( int radix, int exponent ) : BigInteger
radix int The number to be raised to a power.
exponent int The number that specifies the power.
return BigInteger

Quorem() public static method

Calculates the integer result of dividing dividend by divisor then sets dividend to the remainder.
public static Quorem ( BigInteger &dividend, BigInteger divisor ) : int
dividend BigInteger The number that will be divided.
divisor BigInteger The number to divide by.
return int

RightShift() public static method

Shifts a BigInteger value a specified number of bits to the right.
Note: unlike System.Numerics.BigInteger, negative numbers are treated identically to positive numbers.
public static RightShift ( BigInteger value, int shift ) : BigInteger
value BigInteger The value whose bits are to be shifted.
shift int The number of bits to shift to the right.
return BigInteger

SetupQuorum() public static method

Modifies the given values so they are suitable for passing to Quorem.
public static SetupQuorum ( BigInteger &dividend, BigInteger &divisor ) : void
dividend BigInteger The number that will be divided.
divisor BigInteger The number to divide by.
return void

SetupQuorum() public static method

Modifies the given values so they are suitable for passing to Quorem.
public static SetupQuorum ( BigInteger &dividend, BigInteger &divisor, BigInteger &other ) : void
dividend BigInteger The number that will be divided.
divisor BigInteger The number to divide by.
other BigInteger Another value involved in the division.
return void

Subtract() public static method

Subtracts one BigInteger value from another and returns the result.
public static Subtract ( BigInteger left, BigInteger right ) : BigInteger
left BigInteger The value to subtract from.
right BigInteger The value to subtract.
return BigInteger

ToDouble() public method

Returns a double that corresponds to the BigInteger value.
public ToDouble ( ) : double
return double

ToString() public method

Converts the numeric value of the current BigInteger object to its equivalent string representation.
public ToString ( ) : string
return string

Property Details

One public_oe static_oe property

Gets a value that represents the number one (1).
public static BigInteger,Jurassic One
return BigInteger

Zero public_oe static_oe property

Gets a value that represents the number zero (0).
public static BigInteger,Jurassic Zero
return BigInteger