1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * gmpy2_mpz_misc.h * 3 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 4 * Python interface to the GMP or MPIR, MPFR, and MPC multiple precision * 5 * libraries. * 6 * * 7 * Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, * 8 * 2008, 2009 Alex Martelli * 9 * * 10 * Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, * 11 * 2015, 2016, 2017, 2018, 2019, 2020 Case Van Horsen * 12 * * 13 * This file is part of GMPY2. * 14 * * 15 * GMPY2 is free software: you can redistribute it and/or modify it under * 16 * the terms of the GNU Lesser General Public License as published by the * 17 * Free Software Foundation, either version 3 of the License, or (at your * 18 * option) any later version. * 19 * * 20 * GMPY2 is distributed in the hope that it will be useful, but WITHOUT * 21 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 22 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * 23 * License for more details. * 24 * * 25 * You should have received a copy of the GNU Lesser General Public * 26 * License along with GMPY2; if not, see <http://www.gnu.org/licenses/> * 27 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 28 29 #ifndef GMPY_MPZ_MISC_H 30 #define GMPY_MPZ_MISC_H 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 37 static int GMPy_MPZ_NonZero_Slot(MPZ_Object *self); 38 39 static PyObject * GMPy_MPZ_Attrib_GetNumer(MPZ_Object *self, void *closure); 40 static PyObject * GMPy_MPZ_Attrib_GetDenom(MPZ_Object *self, void *closure); 41 static PyObject * GMPy_MPZ_Attrib_GetReal(MPZ_Object *self, void *closure); 42 static PyObject * GMPy_MPZ_Attrib_GetImag(MPZ_Object *self, void *closure); 43 44 static PyObject * GMPy_MPZ_Method_Ceil(PyObject *self, PyObject *other); 45 static PyObject * GMPy_MPZ_Method_Floor(PyObject *self, PyObject *other); 46 static PyObject * GMPy_MPZ_Method_Trunc(PyObject *self, PyObject *other); 47 static PyObject * GMPy_MPZ_Method_Round(PyObject *self, PyObject *other); 48 static PyObject * GMPy_MPZ_Method_NumDigits(PyObject *self, PyObject *args); 49 static Py_ssize_t GMPy_MPZ_Method_Length(MPZ_Object *self); 50 static PyObject * GMPy_MPZ_Method_SubScript(MPZ_Object *self, PyObject *item); 51 static PyObject * GMPy_MPZ_Method_IsSquare(PyObject *self, PyObject *other); 52 static PyObject * GMPy_MPZ_Method_IsDivisible(PyObject *self, PyObject *other); 53 static PyObject * GMPy_MPZ_Method_IsCongruent(PyObject *self, PyObject *args); 54 static PyObject * GMPy_MPZ_Method_IsPower(PyObject *self, PyObject *other); 55 static PyObject * GMPy_MPZ_Method_IsPrime(PyObject *self, PyObject *args); 56 static PyObject * GMPy_MPZ_Method_IsEven(PyObject *self, PyObject *other); 57 static PyObject * GMPy_MPZ_Method_IsOdd(PyObject *self, PyObject *other); 58 static PyObject * GMPy_MP_Method_Conjugate(PyObject *self, PyObject *args); 59 60 static PyObject * GMPy_MPZ_Function_NumDigits(PyObject *self, PyObject *args); 61 static PyObject * GMPy_MPZ_Function_Iroot(PyObject *self, PyObject *args); 62 static PyObject * GMPy_MPZ_Function_IrootRem(PyObject *self, PyObject *args); 63 static PyObject * GMPy_MPZ_Function_Bincoef(PyObject *self, PyObject *args); 64 static PyObject * GMPy_MPZ_Function_GCD(PyObject *self, PyObject *args); 65 static PyObject * GMPy_MPZ_Function_LCM(PyObject *self, PyObject *args); 66 static PyObject * GMPy_MPZ_Function_GCDext(PyObject *self, PyObject *args); 67 static PyObject * GMPy_MPZ_Function_Divm(PyObject *self, PyObject *args); 68 static PyObject * GMPy_MPZ_Function_Fac(PyObject *self, PyObject *other); 69 static PyObject * GMPy_MPZ_Function_Primorial(PyObject *self, PyObject *other); 70 static PyObject * GMPy_MPZ_Function_DoubleFac(PyObject *self, PyObject *other); 71 static PyObject * GMPy_MPZ_Function_MultiFac(PyObject *self, PyObject *args); 72 static PyObject * GMPy_MPZ_Function_Fib(PyObject *self, PyObject *other); 73 static PyObject * GMPy_MPZ_Function_Fib2(PyObject *self, PyObject *other); 74 static PyObject * GMPy_MPZ_Function_Lucas(PyObject *self, PyObject *other); 75 static PyObject * GMPy_MPZ_Function_Lucas2(PyObject *self, PyObject *other); 76 static PyObject * GMPy_MPZ_Function_Isqrt(PyObject *self, PyObject *other); 77 static PyObject * GMPy_MPZ_Function_IsqrtRem(PyObject *self, PyObject *other); 78 static PyObject * GMPy_MPZ_Function_Remove(PyObject *self, PyObject *args); 79 static PyObject * GMPy_MPZ_Function_Invert(PyObject *self, PyObject *args); 80 static PyObject * GMPy_MPZ_Function_Divexact(PyObject *self, PyObject *args); 81 static PyObject * GMPy_MPZ_Function_IsSquare(PyObject *self, PyObject *other); 82 static PyObject * GMPy_MPZ_Function_IsDivisible(PyObject *self, PyObject *args); 83 static PyObject * GMPy_MPZ_Function_IsCongruent(PyObject *self, PyObject *args); 84 static PyObject * GMPy_MPZ_Function_IsPower(PyObject *self, PyObject *other); 85 static PyObject * GMPy_MPZ_Function_IsPrime(PyObject *self, PyObject *args); 86 static PyObject * GMPy_MPZ_Function_NextPrime(PyObject *self, PyObject *other); 87 static PyObject * GMPy_MPZ_Function_Jacobi(PyObject *self, PyObject *args); 88 static PyObject * GMPy_MPZ_Function_Legendre(PyObject *self, PyObject *args); 89 static PyObject * GMPy_MPZ_Function_Kronecker(PyObject *self, PyObject *args); 90 static PyObject * GMPy_MPZ_Function_IsEven(PyObject *self, PyObject *other); 91 static PyObject * GMPy_MPZ_Function_IsOdd(PyObject *self, PyObject *other); 92 93 94 #if PY_MAJOR_VERSION < 3 95 static PyObject * GMPy_MPZ_Oct_Slot(MPZ_Object *self); 96 static PyObject * GMPy_MPZ_Hex_Slot(MPZ_Object *self); 97 #endif 98 99 #ifdef __cplusplus 100 } 101 #endif 102 #endif 103