Namespaces

Types in MathNet.Numerics

Type Euclid

Namespace MathNet.Numerics

Integer number theory functions.

Static Functions

Public Static Functions

int CeilingToPowerOfTwo(this int number)

Find the closest perfect power of two that is larger or equal to the provided 32 bit integer.
Parameters
int number

The number of which to find the closest upper power of two.

Return
int

A power of two.

long CeilingToPowerOfTwo(this long number)

Find the closest perfect power of two that is larger or equal to the provided 64 bit integer.
Parameters
long number

The number of which to find the closest upper power of two.

Return
long

A power of two.

long ExtendedGreatestCommonDivisor(long a, long b, Int64& x, Int64& y)

BigInteger ExtendedGreatestCommonDivisor(BigInteger a, BigInteger b, BigInteger& x, BigInteger& y)

BigInteger GreatestCommonDivisor(BigInteger[] integers)

Returns the greatest common divisor ( gcd ) of a set of big integers.
Parameters
BigInteger[] integers

List of Integers.

Return
BigInteger

Greatest common divisor gcd (list of integers)

BigInteger GreatestCommonDivisor(BigInteger a, BigInteger b)

Returns the greatest common divisor ( gcd ) of two big integers.
Parameters
BigInteger a

First Integer: a.

BigInteger b

Second Integer: b.

Return
BigInteger

Greatest common divisor gcd (a,b)

long GreatestCommonDivisor(long a, long b)

Returns the greatest common divisor ( gcd ) of two integers using Euclid's algorithm.
Parameters
long a

First Integer: a.

long b

Second Integer: b.

Return
long

Greatest common divisor gcd (a,b)

long GreatestCommonDivisor(IList<long> integers)

Returns the greatest common divisor ( gcd ) of a set of integers using Euclid's algorithm.
Parameters
IList<long> integers

List of Integers.

Return
long

Greatest common divisor gcd (list of integers)

long GreatestCommonDivisor(Int64[] integers)

Returns the greatest common divisor ( gcd ) of a set of integers using Euclid's algorithm.
Parameters
Int64[] integers

List of Integers.

Return
long

Greatest common divisor gcd (list of integers)

bool IsEven(this int number)

Find out whether the provided 32 bit integer is an even number.
Parameters
int number

The number to very whether it's even.

Return
bool

True if and only if it is an even number.

bool IsEven(this long number)

Find out whether the provided 64 bit integer is an even number.
Parameters
long number

The number to very whether it's even.

Return
bool

True if and only if it is an even number.

bool IsOdd(this int number)

Find out whether the provided 32 bit integer is an odd number.
Parameters
int number

The number to very whether it's odd.

Return
bool

True if and only if it is an odd number.

bool IsOdd(this long number)

Find out whether the provided 64 bit integer is an odd number.
Parameters
long number

The number to very whether it's odd.

Return
bool

True if and only if it is an odd number.

bool IsPerfectSquare(this int number)

Find out whether the provided 32 bit integer is a perfect square, i.e. a square of an integer.
Parameters
int number

The number to very whether it's a perfect square.

Return
bool

True if and only if it is a perfect square.

bool IsPerfectSquare(this long number)

Find out whether the provided 64 bit integer is a perfect square, i.e. a square of an integer.
Parameters
long number

The number to very whether it's a perfect square.

Return
bool

True if and only if it is a perfect square.

bool IsPowerOfTwo(this long number)

Find out whether the provided 64 bit integer is a perfect power of two.
Parameters
long number

The number to very whether it's a power of two.

Return
bool

True if and only if it is a power of two.

bool IsPowerOfTwo(this int number)

Find out whether the provided 32 bit integer is a perfect power of two.
Parameters
int number

The number to very whether it's a power of two.

Return
bool

True if and only if it is a power of two.

BigInteger LeastCommonMultiple(BigInteger a, BigInteger b)

Returns the least common multiple ( lcm ) of two big integers.
Parameters
BigInteger a

First Integer: a.

BigInteger b

Second Integer: b.

Return
BigInteger

Least common multiple lcm (a,b)

BigInteger LeastCommonMultiple(BigInteger[] integers)

Returns the least common multiple ( lcm ) of a set of big integers.
Parameters
BigInteger[] integers

List of Integers.

Return
BigInteger

Least common multiple lcm (list of integers)

long LeastCommonMultiple(long a, long b)

Returns the least common multiple ( lcm ) of two integers using Euclid's algorithm.
Parameters
long a

First Integer: a.

long b

Second Integer: b.

Return
long

Least common multiple lcm (a,b)

long LeastCommonMultiple(IList<long> integers)

Returns the least common multiple ( lcm ) of a set of integers using Euclid's algorithm.
Parameters
IList<long> integers

List of Integers.

Return
long

Least common multiple lcm (list of integers)

long LeastCommonMultiple(Int64[] integers)

Returns the least common multiple ( lcm ) of a set of integers using Euclid's algorithm.
Parameters
Int64[] integers

List of Integers.

Return
long

Least common multiple lcm (list of integers)

int Log2(this int number)

Evaluate the binary logarithm of an integer number.
Two-step method using a De Bruijn-like sequence table lookup.

BigInteger Modulus(BigInteger dividend, BigInteger divisor)

Canonical Modulus. The result has the sign of the divisor.

long Modulus(long dividend, long divisor)

Canonical Modulus. The result has the sign of the divisor.

int Modulus(int dividend, int divisor)

Canonical Modulus. The result has the sign of the divisor.

float Modulus(float dividend, float divisor)

Canonical Modulus. The result has the sign of the divisor.

double Modulus(double dividend, double divisor)

Canonical Modulus. The result has the sign of the divisor.

long PowerOfTwo(this long exponent)

Raises 2 to the provided integer exponent (0 <= exponent < 63).
Parameters
long exponent

The exponent to raise 2 up to.

Return
long

2 ^ exponent.

int PowerOfTwo(this int exponent)

Raises 2 to the provided integer exponent (0 <= exponent < 31).
Parameters
int exponent

The exponent to raise 2 up to.

Return
int

2 ^ exponent.

BigInteger Remainder(BigInteger dividend, BigInteger divisor)

Remainder (% operator). The result has the sign of the dividend.

long Remainder(long dividend, long divisor)

Remainder (% operator). The result has the sign of the dividend.

int Remainder(int dividend, int divisor)

Remainder (% operator). The result has the sign of the dividend.

float Remainder(float dividend, float divisor)

Remainder (% operator). The result has the sign of the dividend.

double Remainder(double dividend, double divisor)

Remainder (% operator). The result has the sign of the dividend.