gmp_libmpz_lcm Method |
Namespace: Math.Gmp.Native
rop is always positive, irrespective of the signs of op1 and op2. rop will be zero if either op1 or op2 is zero.
// Create, initialize, and set the value of op1 to 2. mpz_t op1 = new mpz_t(); gmp_lib.mpz_init_set_ui(op1, 2U); // Create, initialize, and set the value of op2 to 3. mpz_t op2 = new mpz_t(); gmp_lib.mpz_init_set_ui(op2, 3U); // Create, initialize, and set the value of rop to 0. mpz_t rop = new mpz_t(); gmp_lib.mpz_init(rop); // Set rop to the least common multiple of op1 and op2. gmp_lib.mpz_lcm(rop, op1, op2); // Assert that rop is 6. Assert.IsTrue(gmp_lib.mpz_get_si(rop) == 6); // Release unmanaged memory allocated for rop, op1, and op2. gmp_lib.mpz_clears(rop, op1, op2, null);