Exemplo n.º 1
0
static PyObject *
GMPy_MPC_GetImag_Attrib(MPC_Object *self, void *closure)
{
    MPFR_Object *result = NULL;
    CTXT_Object *context = NULL;

    CHECK_CONTEXT(context);

    if ((result = GMPy_MPFR_New(0, context))) {
        result->rc = mpc_imag(result->f, self->c, GET_MPFR_ROUND(context));
        GMPY_MPFR_CLEANUP(result, context, "imag()");
    }
    return (PyObject*)result;
}
Exemplo n.º 2
0
mpcomplex mpcomplex::Im() const{
    mpfr_t imagPart;
    mpfr_init2(imagPart, mpc_prec);
    mpc_imag(imagPart, mpc_val , default_rnd );
    return mpcomplex(imagPart);
}