Menu - Top - Home - Donate to Me

PeterO.BigInteger

PeterO.BigInteger

public sealed class BigInteger :
    System.IEquatable,
    System.IComparable

Deprecated. Use EInteger from PeterO.Numbers/com.upokecenter.numbers and the output of this class's ToString method.

This class is largely obsolete. It will be replaced by a new version of this class in a different namespace/package and library, called PeterO.Numbers.EInteger in the PeterO.Numbers library (in .NET), or com.upokecenter.numbers.EInteger in the com.github.peteroupc/numbers artifact (in Java). This new class can be used in the CBORObject.FromObject(object) method (by including the new library in your code, among other things).

An arbitrary-precision integer. Thread safety: 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.

This class is largely obsolete. It will be replaced by a new version of this class in a different namespace/package and library, called PeterO.Numbers.EInteger in the PeterO.Numbers library (in .NET), or com.upokecenter.numbers.EInteger in the com.github.peteroupc/numbers artifact (in Java). This new class can be used in the CBORObject.FromObject(object) method (by including the new library in your code, among other things).

An arbitrary-precision integer. Thread safety: 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.

This class is largely obsolete. It will be replaced by a new version of this class in a different namespace/package and library, called PeterO.Numbers.EInteger in the PeterO.Numbers library (in .NET), or com.upokecenter.numbers.EInteger in the com.github.peteroupc/numbers artifact (in Java). This new class can be used in the CBORObject.FromObject(object) method (by including the new library in your code, among other things).

An arbitrary-precision integer. Thread safety: 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.

This class is largely obsolete. It will be replaced by a new version of this class in a different namespace/package and library, called PeterO.Numbers.EInteger in the PeterO.Numbers library (in .NET), or com.upokecenter.numbers.EInteger in the com.github.peteroupc/numbers artifact (in Java). This new class can be used in the CBORObject.FromObject(object) method (by including the new library in your code, among other things).

An arbitrary-precision integer. Thread safety: 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.

Member Summary

ONE

public static readonly PeterO.BigInteger ONE;

BigInteger for the number one.

One

public static PeterO.BigInteger One { get; }

Deprecated. Use EInteger from PeterO.Numbers/com.upokecenter.numbers and the output of this class's ToString method.

Gets the arbitrary-precision integer for one.

Returns:

The arbitrary-precision integer for one.

Zero

public static PeterO.BigInteger Zero { get; }

Deprecated. Use EInteger from PeterO.Numbers/com.upokecenter.numbers and the output of this class's ToString method.

Gets the arbitrary-precision integer for zero.

Returns:

The arbitrary-precision integer for zero.

bitLength

public int bitLength();

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 a value equal to this object's absolute value minus 1.

Return Value:

The number of bits in this object's value. Returns 0 if this object's value is 0 or negative 1.

CompareTo

public sealed int CompareTo(
    PeterO.BigInteger other);

Compares this value to another.

Parameters:

Return Value:

Less than 0 if this value is less than, 0 if equal to, or greater than 0 if greater than the other value.

Equals

public override bool Equals(
    object obj);

Determines whether this object and another object are equal.

Parameters:

Return Value:

true if this object and another object are equal; otherwise, false .

Equals

public sealed bool Equals(
    PeterO.BigInteger other);

Deprecated. Use EInteger from PeterO.Numbers/com.upokecenter.numbers and the output of this class's ToString method.

Returns whether this number's value equals another number's value.

Parameters:

Return Value:

true if this number's value equals another number's value; otherwise, false .

fromBytes

public static PeterO.BigInteger fromBytes(
    byte[] bytes,
    bool littleEndian);

Initializes an arbitrary-precision integer from an array of bytes.

Parameters:

Return Value:

An arbitrary-precision integer. Returns 0 if the byte array's length is 0.

Exceptions:

fromRadixString

public static PeterO.BigInteger fromRadixString(
    string str,
    int radix);

Converts a string to an arbitrary-precision integer.

Parameters:

Return Value:

An arbitrary-precision integer with the same value as given in the string.

Exceptions:

fromString

public static PeterO.BigInteger fromString(
    string str);

Converts a string to an arbitrary-precision integer.

Parameters:

Return Value:

An arbitrary-precision integer with the same value as given in the string.

Exceptions:

GetHashCode

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.

toBytes

public byte[] toBytes(
    bool littleEndian);

Returns a byte array of this object's value. The byte array will take the form of the number's two' s-complement representation, using the fewest bytes necessary to represent its value unambiguously. If this value is negative, the bits that appear "before" the most significant bit of the number will be all ones.

Parameters:

Return Value:

A byte array. If this value is 0, returns a byte array with the single element 0.

toRadixString

public string toRadixString(
    int radix);

Generates a string representing the value of this object, in the given radix.

Parameters:

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 hyphen/minus ("-"). Depending on the radix, the string will use the basic digits 0 to 9 (U+0030 to U+0039) and then the basic 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.

Exceptions:

ToString

public override string ToString();

Converts this object to a text string in base 10.

Return Value:

A string representation of this object. 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).

valueOf

public static PeterO.BigInteger valueOf(
    long longerValue);

Converts a 64-bit signed integer to a big integer.

Parameters:

Return Value:

An arbitrary-precision integer with the same value as the 64-bit number.

Back to CBOR start page.