Example #1
0
static PyObject *
GMPy_Complex_Is_Zero(PyObject *x, CTXT_Object *context)
{
    MPC_Object *tempx;
    int res;

    if (MPC_Check(x)) {
        res = MPC_IS_ZERO_P(x);
    }
    else {
        CHECK_CONTEXT(context);
        if (!(tempx = GMPy_MPC_From_Complex(x, 1, 1, context))) {
            return NULL;
        }
        res = MPC_IS_ZERO_P(tempx);
        Py_DECREF((PyObject*)tempx);
    }

    if (res) {
        Py_RETURN_TRUE;
    }
    else {
        Py_RETURN_FALSE;
    }
}
Example #2
0
static int
GMPy_MPC_NonZero_Slot(MPC_Object *self)
{
    return !MPC_IS_ZERO_P(self->c);
}