Click or drag to resize
gmp_libmpf_swap Method
Swap rop1 and rop2 efficiently.

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 void mpf_swap(
	mpf_t rop1,
	mpf_t rop2
)

Parameters

rop1
Type: Math.Gmp.Nativempf_t
The first result float.
rop2
Type: Math.Gmp.Nativempf_t
The second result float.
Remarks

Both the values and the precisions of the two variables are swapped.

Examples
// Create, initialize, and set a new floating-point number x to 10.
mpf_t x = new mpf_t();
gmp_lib.mpf_init2(x, 128U);
gmp_lib.mpf_set_si(x, 10);

// Create, initialize, and set a new floating-point number y to -210.
mpf_t y = new mpf_t();
gmp_lib.mpf_init2(y, 128U);
gmp_lib.mpf_set_si(y, -210);

// Swap the values of x and y.
gmp_lib.mpf_swap(x, y);

// Assert that the value of x is -210.
Assert.IsTrue(gmp_lib.mpf_get_d(x) == -210.0);

// Assert that the value of y is 10.
Assert.IsTrue(gmp_lib.mpf_get_d(y) == 10.0);

// Release unmanaged memory allocated for x and y.
gmp_lib.mpf_clears(x, y, null);
See Also