static PyObject * GMPy_Real_RelDiff(PyObject *x, PyObject *y, CTXT_Object *context) { MPFR_Object *tempx, *tempy, *result; CHECK_CONTEXT(context); result = GMPy_MPFR_New(0, context); tempx = GMPy_MPFR_From_Real(x, 1, context); tempy = GMPy_MPFR_From_Real(y, 1, context); if (!result || !tempx || !tempy) { Py_XDECREF((PyObject*)result); Py_XDECREF((PyObject*)tempx); Py_XDECREF((PyObject*)tempy); return NULL; } mpfr_clear_flags(); mpfr_reldiff(result->f, tempx->f, tempy->f, GET_MPFR_ROUND(context)); result->rc = 0; _GMPy_MPFR_Cleanup(&result, context); Py_DECREF((PyObject*)tempx); Py_DECREF((PyObject*)tempy); return (PyObject*)result; }
static int reldiff_wrapper (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) { mpfr_reldiff (a, b, c, rnd_mode); return 0; }