From: Alex M. <al...@us...> - 2005-11-07 04:07:14
|
Update of /cvsroot/gmpy/gmpy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31274/src Modified Files: gmpy.c gmpy.h Log Message: Added truediv and floordiv (for mpz only, for now). Index: gmpy.c =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** gmpy.c 7 Nov 2005 00:43:55 -0000 1.12 --- gmpy.c 7 Nov 2005 04:07:04 -0000 1.13 *************** *** 110,113 **** --- 110,119 ---- * 1.01: * cleanups, ensure support for Python 2.4.1 on MacOSX 10.4/XCode 2.1 + * fixed memory leak on divm + * fixed bug on mpq('123') [[str2mpq on string w/o a slash]] + * added floordiv and truediv operators (to mpz only) + * + * TODO: look deeper into divm (when operands are not mutually prime) + * add floordiv and truediv to mpq and mpf * */ *************** *** 159,167 **** long maxzco; /* max mpz that will come as constant (exclusive) */ long qcache; /* size of cache for mpq objects */ ! PyObject* fcoform; /* if !=0, format for float->mpf (via string) */ ! PyObject* ZD_cb; ! PyObject* ZM_cb; ! PyObject* ER_cb; ! PyObject* AT_cb; } options = { 0, 0, 5, 20, -2, 11, 20, 0, 0, 0, 0 }; --- 165,180 ---- long maxzco; /* max mpz that will come as constant (exclusive) */ long qcache; /* size of cache for mpq objects */ ! PyObject* fcoform; /* if non-NULL, format for float->mpf (via string) */ ! /* experimental callbacks for various anomalous cases; if a callback ! is non-NULL, it's called to supply a result or raise an appropriate ! specialized exception, rather than (as per default) gmpy raising a ! normal exception or computing nthe result directly. By request of ! Pearu Peterson, to ease use of gmpy in symbolic computations. ! */ ! PyObject* ZD_cb; /* division by zero */ ! PyObject* ZM_cb; /* multiplication by zero */ ! PyObject* ER_cb; /* erroneous arguments to functions/methods */ ! PyObject* AT_cb; /* getattr-like "as last resort try calling this" ! for getting of attributes from mpz &c instances */ } options = { 0, 0, 5, 20, -2, 11, 20, 0, 0, 0, 0 }; *************** *** 289,293 **** static void mpq_cloc(mpq_t oldo) mpq_cloc_m(oldo) ! /* forward of type-objects and method-arrays for them */ staticforward PyTypeObject Pympz_Type; staticforward PyTypeObject Pympq_Type; --- 302,306 ---- static void mpq_cloc(mpq_t oldo) mpq_cloc_m(oldo) ! /* forward declarations of type-objects and method-arrays for them */ staticforward PyTypeObject Pympz_Type; staticforward PyTypeObject Pympq_Type; *************** *** 5262,5265 **** --- 5275,5294 ---- (unaryfunc) Pympz_oct, (unaryfunc) Pympz_hex, + 0, /* binaryfunc nb_inplace_add; */ + 0, /* binaryfunc nb_inplace_subtract; */ + 0, /* binaryfunc nb_inplace_multiply; */ + 0, /* binaryfunc nb_inplace_divide; */ + 0, /* binaryfunc nb_inplace_remainder; */ + 0, /* ternaryfunc nb_inplace_power; */ + 0, /* binaryfunc nb_inplace_lshift; */ + 0, /* binaryfunc nb_inplace_rshift; */ + 0, /* binaryfunc nb_inplace_and; */ + 0, /* binaryfunc nb_inplace_xor; */ + 0, /* binaryfunc nb_inplace_or; */ + + (binaryfunc) Pympz_div, /* binaryfunc nb_floor_divide; */ + (binaryfunc) Pympf_div, /* binaryfunc nb_true_divide; */ + 0, /* binaryfunc nb_inplace_floor_divide; */ + 0, /* binaryfunc nb_inplace_true_divide; */ }; Index: gmpy.h =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gmpy.h 6 Nov 2005 03:14:41 -0000 1.3 --- gmpy.h 7 Nov 2005 04:07:04 -0000 1.4 *************** *** 142,146 **** #else ! /* This section is used in modules that use gmpy's API */ static void **Pygmpy_API; --- 142,146 ---- #else ! /* This section is used in other C-coded modules that use gmpy's API */ static void **Pygmpy_API; |