Next: String and Stream Input and Output, Previous: Initializing Complex Numbers, Up: Complex Functions
These functions assign new values to already initialized complex numbers
(see Initializing Complex Numbers).
When using any functions with intmax_t
parameter, you must include
<stdint.h>
or <inttypes.h>
before mpc.h, to allow
mpc.h to define prototypes for these functions.
If you need assignment functions that are not in the current API, you can
define them using the MPC_SET_X_Y
macro (see Advanced Functions).
Set the value of rop from op, rounded to the precision of rop with the given rounding mode rnd.
Set the value of rop from op, rounded to the precision of rop with the given rounding mode rnd. The argument op is interpreted as real, so the imaginary part of rop is set to zero with a positive sign. Please note that even a
long int
may have to be rounded, if the destination precision is less than the machine word width. Formpc_set_d
, be careful that the input number op may not be exactly representable as a double-precision number (this happens for 0.1 for instance), in which case it is first rounded by the C compiler to a double-precision number, and then only to a complex number.
Set the real part of rop from op1, and its imaginary part from op2, according to the rounding mode rnd.
For functions assigning complex variables from strings or input streams, see String and Stream Input and Output.