gmp_libmpz_cdiv_qr_ui Method |
Set quotient q to ceiling(n / d), set the remainder r to n - q * d, and return | r |.
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 uint mpz_cdiv_qr_ui(
mpz_t q,
mpz_t r,
mpz_t n,
uint d
)
Public Shared Function mpz_cdiv_qr_ui (
q As mpz_t,
r As mpz_t,
n As mpz_t,
d As UInteger
) As UInteger
public:
static unsigned int mpz_cdiv_qr_ui(
mpz_t^ q,
mpz_t^ r,
mpz_t^ n,
unsigned int d
)
static member mpz_cdiv_qr_ui :
q : mpz_t *
r : mpz_t *
n : mpz_t *
d : uint32 -> uint32
Parameters
- q
- Type: Math.Gmp.Nativempz_t
The result quotient integer. - r
- Type: Math.Gmp.Nativempz_t
The result remainder integer. - n
- Type: Math.Gmp.Nativempz_t
The numerator integer. - d
- Type: SystemUInt32
The denominator integer.
Return Value
Type:
UInt32Return |
r |.
Examples
mpz_t n = new mpz_t();
gmp_lib.mpz_init_set_si(n, 10000);
mpz_t q = new mpz_t();
mpz_t r = new mpz_t();
gmp_lib.mpz_inits(q, r, null);
Assert.IsTrue(gmp_lib.mpz_cdiv_qr_ui(q, r, n, 3U) == 2U);
Assert.IsTrue(gmp_lib.mpz_get_si(q) == 3334);
Assert.IsTrue(gmp_lib.mpz_get_si(r) == -2);
gmp_lib.mpz_clears(n, q, r, null);
Dim n As New mpz_t()
gmp_lib.mpz_init_set_si(n, 10000)
Dim q As New mpz_t()
Dim r As New mpz_t()
gmp_lib.mpz_inits(q, r, Nothing)
Assert.IsTrue(gmp_lib.mpz_cdiv_qr_ui(q, r, n, 3UI) = 2UI)
Assert.IsTrue(gmp_lib.mpz_get_si(q) = 3334)
Assert.IsTrue(gmp_lib.mpz_get_si(r) = -2)
gmp_lib.mpz_clears(n, q, r, Nothing)
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