Next: , Previous: Miscellaneous Complex Functions, Up: Complex Functions


5.10 Advanced Functions

— Macro: MPC_SET_X_Y (real_suffix, imag_suffix, real, imag, rnd)

MPC_SET_X_Y cannot be used by itself, it is designed to serve as the body of an assignment function definition. The real_suffix and imag_suffix parameters are the _x suffixes of the mpfr_set_x functions you would use to set the real and imaginary part separately. real (respectively imag) is the value you want to assign to the real (resp. imaginary) part, its type must conform to real_suffix (resp. imag_suffix). rnd is the mpc_rnd_t rounding mode. The return value is the usual inexact value (see Return Value).

For instance, you can define mpc_set_ui_d as follows:

          int mpc_set_ui_d (mpc_t rop, long int re, double im, mpc_rnd_t rnd)
              MPC_SET_X_Y (_ui, _d, re, im, rnd);

If one part is set to an mpfr_t value, the corresponding suffix is empty, as follows:

          int mpc_set_ui_fr (mpc_t rop, long int re, mpfr_ptr im, mpc_rnd_t rnd)
              MPC_SET_X_Y (_ui, , re, im, rnd);

This macro might be removed in future versions.