gmp_lib.mpn_sizeinbase Method

GMP Native Interface for .NET

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
)
Public Shared Function mpn_sizeinbase ( 
	xp As mp_ptr,
	n As mp_size_t,
	base As Integer
) As size_t
public:
static size_t mpn_sizeinbase(
	mp_ptr^ xp, 
	mp_size_t n, 
	int base
)
static member mpn_sizeinbase : 
        xp : mp_ptr * 
        n : mp_size_t * 
        base : int -> size_t 

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);
' Create multi-precision operands, and expected result.
Dim xp As New mp_ptr(New UInteger() { &H1, &H1})

' 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)

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also