Click or drag to resize
gmp_libmpn_sizeinbase Method
Return the size of {xp, n} measured in number of digits in the given base.

Namespace:  Math.Gmp.Native
Assembly:  Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static size_t mpn_sizeinbase(
	mp_ptr xp,
	mp_size_t n,
	int base
)

Parameters

xp
Type: Math.Gmp.Nativemp_ptr
The operand integer.
n
Type: Math.Gmp.Nativemp_size_t
The number of limbs of xp.
base
Type: SystemInt32
The base.

Return Value

Type: size_t
The size of {xp, n} measured in number of digits in the given base.
Remarks

base can vary from 2 to 62. Requires n > 0 and xp[n - 1] > 0. The result will be either exact or 1 too big. If base is a power of 2, the result is always exact.

Examples
// Create multi-precision operands, and expected result.
mp_ptr xp = new mp_ptr(new uint[] { 0x00000001, 0x00000001 });

// Assert that the number of bits required is 33.
Assert.IsTrue(gmp_lib.mpn_sizeinbase(xp, xp.Size, 2) == 33);

// Release unmanaged memory.
gmp_lib.free(xp);
See Also