You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(1) |
Feb
|
Mar
(11) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(9) |
Sep
|
Oct
|
Nov
|
Dec
(5) |
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(21) |
Dec
|
2006 |
Jan
|
Feb
(6) |
Mar
(1) |
Apr
(8) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
(6) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Alex M. <al...@us...> - 2007-02-24 00:16:29
|
Update of /cvsroot/gmpy/gmpy/doc In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv19239/doc Modified Files: gmpydoc.txt index.html Log Message: Further minor cleanups Index: gmpydoc.txt =================================================================== RCS file: /cvsroot/gmpy/gmpy/doc/gmpydoc.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gmpydoc.txt 13 Nov 2005 01:27:12 -0000 1.6 --- gmpydoc.txt 24 Feb 2007 00:16:27 -0000 1.7 *************** *** 36,39 **** --- 36,40 ---- Minor editing for version 1.01 (2005/11/12); maintainer's preferred email changed to al...@gm... . + Minor editing for version 1.02 (2007/02/19). *************** *** 56,59 **** --- 57,63 ---- the Windows binary installers for gmpy 1.01. + Chip Turner and Daniel Lord helped with the changes leading to version + 1.02, so, thanks to them as well! + *Installation and testing* *************** *** 63,73 **** though gmpy doesn't yet expose any GMP4-only functionality and presumably "should" build OK with GMP 3. No support nor bugfixes ! planned for older releases of either Python or GMP. ! To build gmpy from sources, unpack the sources zipfile ! (gmpy-sources-101.zip, for example, for release 1.01) into a new, ! dedicated directory; cd to that directory (from any shell on ! Unix/Linux, from a 'Dos box' aka 'command box' on Windows, from ! Terminal on Mac OS X, etc), and run the command: python setup.py install --- 67,78 ---- though gmpy doesn't yet expose any GMP4-only functionality and presumably "should" build OK with GMP 3. No support nor bugfixes ! are planned for older releases of either Python or GMP. ! To build gmpy from sources, get the sources from svn (or a sources ! zipfile, such as gmpy-sources-101.zip for release 1.01; old versions are ! at http://gmpy.sourceforge.net, new ones at ! http://code.google.com/p/gmpy/source) into a new, dedicated directory; ! cd to that directory (from any shell on Unix/Linux, from a 'Dos box' aka ! 'command box' on Windows, from Terminal on Mac OS X, etc), and run: python setup.py install *************** *** 82,86 **** http://www.cs.nyu.edu/exact/core/gmp/ . Take care, when installing GMP 4, that an older GMP 3 doesn't keep being used ! instead, e.g. on Linux, if you have a system-installed GMP 3 in /usr/lib and install the newer GMP 4 using GMP's default settings (it then goes into /usr/local/lib, and depending on various --- 87,91 ---- http://www.cs.nyu.edu/exact/core/gmp/ . Take care, when installing GMP 4, that an older GMP 3 doesn't keep being used ! instead; e.g. on Linux, if you have a system-installed GMP 3 in /usr/lib and install the newer GMP 4 using GMP's default settings (it then goes into /usr/local/lib, and depending on various *************** *** 93,97 **** *addition* to the gmpy-sources-101.zip zipfile (which is in any case recommended, since it contains all of gmpy's docs, tests and ! examples, as well as gmpy's soruces). The sources zipfile also contains this file (gmpydoc.txt), an --- 98,103 ---- *addition* to the gmpy-sources-101.zip zipfile (which is in any case recommended, since it contains all of gmpy's docs, tests and ! examples, as well as gmpy's soruces). These old installers are, at ! the time of this writing, only available at gmpy.sourceforge.net. The sources zipfile also contains this file (gmpydoc.txt), an *************** *** 115,134 **** """ ! Unit tests for gmpy 1.01 release candidate ! on Python 2.4.1 (#1, Apr 21 2005, 11:14:17) ! [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] ! Testing gmpy 1.01 (GMP 4.1.2), default caching (20, 20, -2..11) ! gmpy_test_cvr 262 tests, 0 failures gmpy_test_rnd 26 tests, 0 failures ! gmpy_test_mpf 154 tests, 0 failures ! gmpy_test_mpq 260 tests, 0 failures ! gmpy_test_mpz 370 tests, 0 failures ! 6 items had no tests: ! gmpy_test_cvr._test [[ snip snip ]] ! 28 items passed all tests: [[ snip snip ]] ! 1072 tests in 34 items. ! 1072 passed and 0 failed. Test passed. """ --- 121,140 ---- """ ! Unit tests for gmpy 1.02 release candidate ! on Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) ! [GCC 4.0.1 (Apple Computer, Inc. build 5341)] ! Testing gmpy 1.02 (GMP 4.2), default caching (20, 20, -2..11) ! gmpy_test_cvr 270 tests, 0 failures gmpy_test_rnd 26 tests, 0 failures ! gmpy_test_mpf 155 tests, 0 failures ! gmpy_test_mpq 264 tests, 0 failures ! gmpy_test_mpz 386 tests, 0 failures ! gmpy_test_dec 16 tests, 0 failures ! 7 items had no tests: [[ snip snip ]] ! 31 items passed all tests: [[ snip snip ]] ! 1117 tests in 38 items. ! 1117 passed and 0 failed. Test passed. """ *************** *** 145,158 **** the key issue is the 'Test passed' line at the end of each run! ! *PLEASE* report any failures to gmpy's maintainers, with all ! details you can supply on your machine, on your OS, and on your ! installation of GMP 4, gmpy 1.01, Python 2.3 or 2.4, and any other ! relevant issue (your C/C++ compiler & libraries, &c). *THANKS* in ! advance -- bug reporting and feedback is your key contribution to ! the gmpy project! (Reports of any _successful_ installations will ! also be welcome, if it's accompanied by enough details -- again, ! THANKS in advance!). The best way to report bugs (including ! unit-test failures) is via the SF bug tracker, specifically ! https://sourceforge.net/tracker/?group_id=13335&atid=113335 . --- 151,163 ---- the key issue is the 'Test passed' line at the end of each run! ! *PLEASE* report any failures to gmpy's maintainers, with all details you ! can supply on your machine, on your OS, and on your installation of GMP ! 4, gmpy 1.02, Python 2.3, 2.4, or 2.5, and any other relevant issue ! (your C/C++ compiler & libraries, &c). *THANKS* in advance -- bug ! reporting and feedback is your key contribution to the gmpy project! ! (Reports of any _successful_ installations will also be welcome, if it's ! accompanied by enough details -- again, THANKS in advance!). The best ! way to report bugs (including unit-test failures) is via the Google Code ! issue tracker. *************** *** 198,204 **** it's of a floating type, in which case the .mpz object is coerced to that floating type instead (or mpq, or complex, ditto). ! However, gmpy currently does not support coercion of ANY of its ! types to/from the decimal.Decimal class introduced in the standard ! library in Python 2.4. --- 203,212 ---- it's of a floating type, in which case the .mpz object is coerced to that floating type instead (or mpq, or complex, ditto). ! gmpy currently offers experimental support for coercion to its ! types from the decimal.Decimal class introduced in the standard ! library in Python 2.4; however, that support is experimental ! because it's done by "monkey patching" the Decimal class on the ! fly, and therefore it could stop working any time (e.g., if Decimal is ! made into a C-coded type in some future version of Python). Index: index.html =================================================================== RCS file: /cvsroot/gmpy/gmpy/doc/index.html,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** index.html 12 Nov 2005 00:04:45 -0000 1.6 --- index.html 24 Feb 2007 00:16:27 -0000 1.7 *************** *** 3,9 **** --- 3,12 ---- <TITLE>Welcome to General Multiprecision PYthon </TITLE> + + <!-- <LINK rel="stylesheet" href="http://sourceforge.net/sourceforge.css" type="text/css"> + --> <STYLE> *************** *** 14,22 **** <BODY> <FONT SIZE=-1> ! Last updated on: 2005, Nov 12; ! for GMPY release: 1.01 beta ! <A href="http://sourceforge.net"> ! <IMG src="http://sourceforge.net/sflogo.php?group_id=13335&type=1" ! width="88" height="31" border="0" alt="Go to main SourceForge page"></A> <br> </FONT> --- 17,25 ---- <BODY> <FONT SIZE=-1> ! Last updated on: 2007, Feb 19; ! for GMPY release: 1.2 release candidate ! <A href="http://code.google.com/p/gmpy/"> ! <IMG src="http://code.google.com/images/code_sm.png" ! width="88" height="31" border="0" alt="Go to Google Code gmpy page"></A> <br> </FONT> *************** *** 43,54 **** <H1>The GMPY Module</H1> <P> ! Existing Python modules expose a subset of the integral-MP ! (MPZ) functionality of earlier releases of the GMP library. ! The first GMPY goal is to develop this module into a complete ! exposure of MPZ, MPF (floating-point), and MPQ (rational) ! functionality of current GMP (release 4), that will fully ! support current Python releases (2.2, 2.3, 2.4) and the 'distutils' ! (and also support a "C API" allowing some level of interoperation ! with other C-written extension modules for Python). <p> <b>Note</b>: the module's ability to be used as a "drop-in --- 46,60 ---- <H1>The GMPY Module</H1> <P> ! Python modules older than GMPY exposes a subset of the integral-MP ! (MPZ) functionality of earlier releases of the GMP library. The ! first GMPY goal (currently nearly reached) was to develop the gmpy ! module into a complete exposure of MPZ, MPF (floating-point), and ! MPQ (rational) functionality of current GMP (release 4), as well ! as auxiliary functionality such as random number generation, with ! full support for current Python releases (2.3 and up) and the ! Python 'distutils' (and also support for a "C API" allowing some ! level of interoperation with other C-written extension modules for ! Python). ! <p> <b>Note</b>: the module's ability to be used as a "drop-in *************** *** 59,63 **** to support it. <P> ! This first module is called <b>gmpy</b>, just like the whole project. <P> The extended MP floating-point facilities of --- 65,70 ---- to support it. <P> ! This first GMPY ! module is called <b>gmpy</b>, just like the whole project. <P> The extended MP floating-point facilities of *************** *** 65,70 **** will later also be considered for inclusion in gmpy (either within the same module, or as a further, separate add-on module). ! Rooting for MPFR to be merged with GMP so we can avoid some ! awkwardness (but seeing no movement on this front so far). <H2>Mutability... but <u>not</u> for now</H2> --- 72,77 ---- will later also be considered for inclusion in gmpy (either within the same module, or as a further, separate add-on module). ! [[ Rooting for MPFR to be merged with GMP so we can avoid some ! awkwardness (but seeing no movement on this front so far) ]]. <H2>Mutability... but <u>not</u> for now</H2> *************** *** 90,96 **** <H1>Project Status and near-future plans</H1> ! The gmpy module's beta release (latest current release ! as of 2005/11/12: 1.01) is available for download in both ! source and Windows-binary form. It exposes all of the mpz, mpq and mpf functionality that was already available in GMP 3.1, and most of the random-number generation functionality (there are no --- 97,112 ---- <H1>Project Status and near-future plans</H1> ! The gmpy module's release-candidate release (latest current release ! as of 2007/02/18: 1.01) is available for download in both ! source and Windows-binary form ! ! [[TODO: make the downloadable tarball and binary releases of 1.02 ! for Windows and MacOSX available on code.google.com: currently, ! 1.02 exists only in the SVN source repository on code.google.com, ! and binary tarballs and releases exist only for older releases, ! 1.01 and back, on the project's previous home, gmpy.sf.net, and ! are not maintained any more]]. ! ! gmpy 1.02 exposes all of the mpz, mpq and mpf functionality that was already available in GMP 3.1, and most of the random-number generation functionality (there are no *************** *** 155,159 **** (mostly provided for the specific use of PySymbolic, and intended to be tested by that package). We'll have to do better, eventually, but, for ! now, this can be considered OK for a beta-release. <p> In the attempt to make gmpy as useful as can be for both stand-alone --- 171,175 ---- (mostly provided for the specific use of PySymbolic, and intended to be tested by that package). We'll have to do better, eventually, but, for ! now, this can be considered OK. <p> In the attempt to make gmpy as useful as can be for both stand-alone *************** *** 172,186 **** proven unnecessary. All relevant GMP 4 functionality will be exposed. <p> ! No predictions on timing, though. gmpy 1.01 meets all current needs of the main author, so his motivation to work more on it is low:-). So, don't hold your breath (pitching in and helping it happen, on the other hand, _might_ be advisable, and will surely yield results:-). <p> ! <A HREF="http://sourceforge.net/projects/gmpy/">Project ! Summary, downloads, &tc</A> ! ! <A href="http://sourceforge.net/projects/gmpy/"> ! <IMG src="http://sourceforge.net/sflogo.php?group_id=13335&type=1" ! width="88" height="31" border="0" alt="Project Summary Page"></A> </BODY> </HTML> --- 188,201 ---- proven unnecessary. All relevant GMP 4 functionality will be exposed. <p> ! No predictions on timing, though. gmpy 1.02 meets all current needs of the main author, so his motivation to work more on it is low:-). So, don't hold your breath (pitching in and helping it happen, on the other hand, _might_ be advisable, and will surely yield results:-). <p> ! <A HREF="http://code.google.com/p/gmpy/">Project page on ! code.google.com</A> ! <A href="http://code.google.com/p/gmpy/"> ! <IMG src="http://code.google.com/images/code_sm.png" ! width="88" height="31" border="0" alt="Go to Google Code gmpy page"></A> </BODY> </HTML> |
From: Alex M. <al...@us...> - 2007-02-24 00:16:29
|
Update of /cvsroot/gmpy/gmpy In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv19239 Modified Files: setes.py setup.py Log Message: Further minor cleanups Index: setes.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/setes.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** setes.py 11 Nov 2005 21:52:23 -0000 1.3 --- setes.py 24 Feb 2007 00:16:27 -0000 1.4 *************** *** 15,19 **** maintainer = "Alex Martelli", maintainer_email = "al...@gm...", ! url = "http://gmpy.sourceforge.net/", ext_modules = [ gmpy_ext ] --- 15,19 ---- maintainer = "Alex Martelli", maintainer_email = "al...@gm...", ! url = "http://code.google.com/p/gmpy/source/", ext_modules = [ gmpy_ext ] Index: setup.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/setup.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** setup.py 24 Feb 2007 00:00:50 -0000 1.10 --- setup.py 24 Feb 2007 00:16:27 -0000 1.11 *************** *** 31,37 **** maintainer = "Alex Martelli", maintainer_email = "al...@gm...", ! url = "http://gmpy.sourceforge.net/", description = "GMP-4 to Python-2.{2-5} interface", ! download_url = "http://http://prdownloads.sourceforge.net/gmpy/gmpy-sources-101.zip?download", classifiers = [ --- 31,37 ---- maintainer = "Alex Martelli", maintainer_email = "al...@gm...", ! url = "http://code.google.com/p/gmpy/", description = "GMP-4 to Python-2.{2-5} interface", ! # download_url = "http://http://prdownloads.sourceforge.net/gmpy/gmpy-sources-101.zip?download", classifiers = [ |
From: Alex M. <al...@us...> - 2007-02-24 00:16:29
|
Update of /cvsroot/gmpy/gmpy/test In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv19239/test Modified Files: gmpy_test_mpz.py gmpy_test_rnd.py Log Message: Further minor cleanups Index: gmpy_test_mpz.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_mpz.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** gmpy_test_mpz.py 24 Feb 2007 00:00:50 -0000 1.13 --- gmpy_test_mpz.py 24 Feb 2007 00:16:27 -0000 1.14 *************** *** 10,14 **** ''' ! import gmpy as _g, doctest, sys, operator __test__={} a=_g.mpz(123) --- 10,14 ---- ''' ! import gmpy as _g, doctest, sys, operator, gc __test__={} a=_g.mpz(123) *************** *** 439,446 **** --- 439,448 ---- >>> _g.divm(0,1,2) mpz(0) + >>> _siz = 87654 >>> _siz = _memsize() >>> for x in xrange(45678): ... _xx=_g.divm(b,a,20) >>> del _xx + >>> __ = gc.collect() >>> _memsize()-_siz 0 Index: gmpy_test_rnd.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_rnd.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gmpy_test_rnd.py 24 Feb 2007 00:00:50 -0000 1.7 --- gmpy_test_rnd.py 24 Feb 2007 00:16:27 -0000 1.8 *************** *** 109,113 **** ekrnutplo >>> try: r('shuf','astring') ! ... except TypeError, e: print int('does not support item assignment' in str(e)) 1 >>> r('shuf',23) --- 109,113 ---- ekrnutplo >>> try: r('shuf','astring') ! ... except TypeError, e: print int("does not support item assignment" in str(e)) 1 >>> r('shuf',23) |
From: Alex M. <al...@us...> - 2007-02-24 00:00:57
|
Update of /cvsroot/gmpy/gmpy/test In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv12232/test Modified Files: gmpy_test_cvr.py gmpy_test_dec.py gmpy_test_mpf.py gmpy_test_mpz.py gmpy_test_rnd.py Log Message: Clean up and make equivalent to the current "authoritative" release (now hosted on Google Code) 1.02 pre . Index: gmpy_test_cvr.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_cvr.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gmpy_test_cvr.py 22 Apr 2006 23:31:30 -0000 1.8 --- gmpy_test_cvr.py 24 Feb 2007 00:00:50 -0000 1.9 *************** *** 3,10 **** # test-version 1.02 r''' ! >>> print int(_g.gmp_version() in ('4.2', '4.1.4', '4.1.2', '4.0.1', '3.1.1')) 1 >>> _g.version() '1.02' ''' --- 3,12 ---- # test-version 1.02 r''' ! >>> print int(_g.gmp_version()[:3] in ('4.2', '4.1', '4.0', '3.1')) 1 >>> _g.version() '1.02' + >>> int('gmpy.c' in _g._cvsid()) + 1 ''' *************** *** 397,400 **** --- 399,404 ---- >>> _g.mpf(9,100)**_g.mpf(0.5) mpf('3.e0') + >>> _g.mpf(0)**2 + mpf('0.e0') >>> pow(_g.mpf(2),3,-5) Traceback (most recent call last): *************** *** 459,462 **** --- 463,474 ---- File "<stdin>", line 1, in ? ValueError: sqrt of negative number + >>> _g.jacobi(23, -34) + Traceback (most recent call last): + ... + ValueError: jacobi's y must be odd prime > 0 + >>> _g.legendre(23, -34) + Traceback (most recent call last): + ... + ValueError: legendre's y must be odd and > 0 ''' *************** *** 464,468 **** if chat: print "Unit tests for gmpy 1.02 release candidate (extra cover)" ! print " running on Python",sys.version print print "Testing gmpy %s (GMP %s) with default caching" \ --- 476,480 ---- if chat: print "Unit tests for gmpy 1.02 release candidate (extra cover)" ! print " running on Python", sys.version print print "Testing gmpy %s (GMP %s) with default caching" \ Index: gmpy_test_dec.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_dec.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gmpy_test_dec.py 22 Apr 2006 23:31:30 -0000 1.2 --- gmpy_test_dec.py 24 Feb 2007 00:00:50 -0000 1.3 *************** *** 54,58 **** def _test(chat=None): if chat: ! print "Unit tests for gmpy 1.1 release candidate (decimal interoperation)" print " running on Python",sys.version print --- 54,58 ---- def _test(chat=None): if chat: ! print "Unit tests for gmpy 1.02 release candidate (decimal interoperation)" print " running on Python",sys.version print Index: gmpy_test_mpf.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_mpf.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gmpy_test_mpf.py 22 Apr 2006 23:31:30 -0000 1.8 --- gmpy_test_mpf.py 24 Feb 2007 00:00:50 -0000 1.9 *************** *** 122,125 **** --- 122,127 ---- raise ValueError, what ValueError: sqrt of negative number + >>> _g.pi(64) + mpf('3.14159265358979323846e0',64) >>> ''' Index: gmpy_test_mpz.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_mpz.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** gmpy_test_mpz.py 26 Feb 2006 07:36:59 -0000 1.12 --- gmpy_test_mpz.py 24 Feb 2007 00:00:50 -0000 1.13 *************** *** 10,14 **** ''' ! import gmpy as _g, doctest,sys __test__={} a=_g.mpz(123) --- 10,14 ---- ''' ! import gmpy as _g, doctest, sys, operator __test__={} a=_g.mpz(123) *************** *** 53,56 **** --- 53,76 ---- return factors + if sys.version[:3] >= '2.5': + __test__['index']=\ + r''' + >>> range(333)[a] + 123 + >>> range(333)[b] + Traceback (innermost last): + ... + IndexError: list index out of range + >>> ix = operator.index + >>> ix(_g.mpz(sys.maxint)) == sys.maxint + True + >>> type(ix(_g.mpz(sys.maxint))) is int + True + >>> ix(_g.mpz(sys.maxint+1)) == sys.maxint+1 + True + >>> type(ix(_g.mpz(sys.maxint+1))) is long + True + ''' + __test__['elemop']=\ r''' *************** *** 505,509 **** Traceback (most recent call last): File "<stdin>", line 1, in ? ! ValueError: legendres's y must be odd and > 0 >>> _g.legendre(3) Traceback (innermost last): --- 525,529 ---- Traceback (most recent call last): File "<stdin>", line 1, in ? ! ValueError: legendre's y must be odd and > 0 >>> _g.legendre(3) Traceback (innermost last): Index: gmpy_test_rnd.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_rnd.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gmpy_test_rnd.py 26 Feb 2006 07:08:19 -0000 1.6 --- gmpy_test_rnd.py 24 Feb 2007 00:00:50 -0000 1.7 *************** *** 108,115 **** plurotenk ekrnutplo ! >>> r('shuf','astring') ! Traceback (most recent call last): ! ... ! TypeError: object does not support item assignment >>> r('shuf',23) Traceback (most recent call last): --- 108,114 ---- plurotenk ekrnutplo ! >>> try: r('shuf','astring') ! ... except TypeError, e: print int('does not support item assignment' in str(e)) ! 1 >>> r('shuf',23) Traceback (most recent call last): |
From: Alex M. <al...@us...> - 2007-02-24 00:00:56
|
Update of /cvsroot/gmpy/gmpy In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv12232 Modified Files: README setup.py Log Message: Clean up and make equivalent to the current "authoritative" release (now hosted on Google Code) 1.02 pre . Index: README =================================================================== RCS file: /cvsroot/gmpy/gmpy/README,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README 11 Nov 2005 21:52:23 -0000 1.2 --- README 24 Feb 2007 00:00:49 -0000 1.3 *************** *** 1,8 **** ! General MultiPrecision arithmetic for Python -- i.e., Python 2.2/.3/2.4 ! interface module for library GMP 4 -- release 1.01 beta (Nov 2005). Detailed documentation in subdirectory doc. ! To install gmpy 1.01 from sources (you need to have Python 2.2 or better, and GMP 4, previously installed): at a shell prompt, python setup.py install --- 1,12 ---- ! General MultiPrecision arithmetic for Python -- i.e., Python 2.2/.3/2.4/2.5 ! interface module for library GMP 4 -- release 1.02 candidate (Feb 2007). ! ! The gmpy project is moving to Google Code: ! http://code.google.com/p/gmpy/ ! Please check that site for better-updated sources, docs, etc. Detailed documentation in subdirectory doc. ! To install gmpy 1.02 from sources (you need to have Python 2.2 or better, and GMP 4, previously installed): at a shell prompt, python setup.py install *************** *** 10,18 **** than having to rebuid from sources; to build from sources, you need a Windows installation of GMP 4 (http://www.cs.nyu.edu/exact/core/gmp/). To test your installation: cd test, then python gmpy_test.py ! For any support request, mail Alex Martelli, al...@gm... (for bug ! reports, please use sourceforge.net's bug-report system instead). --- 14,24 ---- than having to rebuid from sources; to build from sources, you need a Windows installation of GMP 4 (http://www.cs.nyu.edu/exact/core/gmp/). + Binary installations are also available for MacOSX (and for many Linux + distributions, but those are not distributed by the gmpy project). To test your installation: cd test, then python gmpy_test.py ! For any support request, mail Alex Martelli, al...@gm... (or, better, use ! the issues and wiki entries of the Google Code URL previously given). Index: setup.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/setup.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** setup.py 22 Apr 2006 23:31:30 -0000 1.9 --- setup.py 24 Feb 2007 00:00:50 -0000 1.10 *************** *** 19,22 **** --- 19,24 ---- libdirs=['/usr/local/lib'] + # decomment next line (w/gcc, only!) to support gcov + # os.environ['CFLAGS'] = '-fprofile-arcs -ftest-coverage -O0' # prepare the extension for building gmpy_ext = Extension('gmpy', sources=['src/gmpy.c'], *************** *** 26,34 **** setup (name = "gmpy", ! version = "1.01", maintainer = "Alex Martelli", maintainer_email = "al...@gm...", url = "http://gmpy.sourceforge.net/", ! description = "GMP-4 to Python-2.{2,3,4} interface", download_url = "http://http://prdownloads.sourceforge.net/gmpy/gmpy-sources-101.zip?download", --- 28,36 ---- setup (name = "gmpy", ! version = "1.02", maintainer = "Alex Martelli", maintainer_email = "al...@gm...", url = "http://gmpy.sourceforge.net/", ! description = "GMP-4 to Python-2.{2-5} interface", download_url = "http://http://prdownloads.sourceforge.net/gmpy/gmpy-sources-101.zip?download", |
From: Alex M. <al...@us...> - 2007-02-24 00:00:54
|
Update of /cvsroot/gmpy/gmpy/src In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv12232/src Modified Files: gmpy.c gmpy.h Log Message: Clean up and make equivalent to the current "authoritative" release (now hosted on Google Code) 1.02 pre . Index: gmpy.c =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** gmpy.c 23 Apr 2006 01:10:11 -0000 1.25 --- gmpy.c 24 Feb 2007 00:00:50 -0000 1.26 *************** *** 125,136 **** * sly insertion on-the-fly into the decimal.Decimal class (!) * two bugfixes, thanks to Simon Burton ! * ! * 1.03: ! * add support for Py_ssize_t for compatibility with Python 2.5 ! * add support for __index__ in Python 2.5 ! * ! * 1.03: ! * add support for Py_ssize_t for compatibility with Python 2.5 ! * add support for __index__ in Python 2.5 * */ --- 125,134 ---- * sly insertion on-the-fly into the decimal.Decimal class (!) * two bugfixes, thanks to Simon Burton ! * Brought back into C89 compliance (thanks to Chip Turner), had ! * drifted to C99 (declarations in the middle of the code). ! * Python 2.5 support (Py_ssize_t, __index__) thanks to Chip Turner ! * Pushed coverage to 93.3% (missing only "sanity check" level error ! * tests [mostly for out-of-memory conditions], output to stderr ! * conditioned by options.debug, & a couple of very obscure cases) * */ *************** *** 1465,1476 **** #if Py_TPFLAGS_HAVE_INDEX ! static Py_ssize_t Pympz_asindex(PympzObject *x) { ! if(notanint(x->z)) { ! PyErr_SetString(PyExc_OverflowError, "mpz too large for ssize_t"); ! return 0; ! } ! return mpz_get_si(x->z); } #endif --- 1463,1473 ---- #if Py_TPFLAGS_HAVE_INDEX ! static PyObject* Pympz_asindex(PympzObject *x) { ! PyObject* result = mpz2int(x); ! if(result) return result; ! PyErr_Clear(); ! return mpz2long(x); } #endif *************** *** 5098,5102 **** assert(Pympz_Check(other)); if(mpz_sgn(Pympz_AS_MPZ(other))<=0) { ! static char* msg = "legendres's y must be odd and > 0"; if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, --- 5095,5099 ---- assert(Pympz_Check(other)); if(mpz_sgn(Pympz_AS_MPZ(other))<=0) { ! static char* msg = "legendre's y must be odd and > 0"; if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, *************** *** 5291,5294 **** --- 5288,5292 ---- static int randinited=0; static int randquality=0; + #if (__GNU_MP_VERSION==4) && (__GNU_MP_VERSION_MINOR>=2) # define do_randinit(state, size) gmp_randinit_lc_2exp_size(state, size) *************** *** 5296,5300 **** #else # define do_randinit(state, size) gmp_randinit(state, GMP_RAND_ALG_LC, size) ! # if (__GNU_MP_VERSION==4) # define SEEDOF(x) ((x)->_mp_seed) # else --- 5294,5298 ---- #else # define do_randinit(state, size) gmp_randinit(state, GMP_RAND_ALG_LC, size) ! # if (__GNU_MP_VERSION==4) # define SEEDOF(x) ((x)->_mp_seed) # else *************** *** 5303,5311 **** #endif - #if __GNU_MP__ >= 4 - #else - #endif - - static int randbits(PyObject* arg) { --- 5301,5304 ---- *************** *** 5502,5507 **** 0, /* binaryfunc nb_inplace_floor_divide; */ 0, /* binaryfunc nb_inplace_true_divide; */ #if Py_TPFLAGS_HAVE_INDEX ! (lenfunc) Pympz_asindex, /* lenfunc nb_index; */ #endif }; --- 5495,5501 ---- 0, /* binaryfunc nb_inplace_floor_divide; */ 0, /* binaryfunc nb_inplace_true_divide; */ + #if Py_TPFLAGS_HAVE_INDEX ! (unaryfunc) Pympz_asindex, /* unaryfunc nb_index; */ #endif }; *************** *** 5942,5945 **** --- 5936,5941 ---- initgmpy(void) { + PyObject* decimal_module = NULL; + Pympz_Type.ob_type = &PyType_Type; Pympq_Type.ob_type = &PyType_Type; *************** *** 5958,5980 **** /* Experimental: adapt module decimal to our needs */ ! char* tweak_decimal = ! "def __gmpy_z__(self, f=gmpy.mpz): return f(int(self))\n" ! "def __gmpy_q__(self, f=gmpy.mpq): return f(str(self))\n" ! "def __gmpy_f__(self, f=gmpy.mpf): return f(str(self))\n" ! "try:\n" ! " decimal.Decimal.__gmpy_z__ = __gmpy_z__\n" ! " decimal.Decimal.__gmpy_q__ = __gmpy_q__\n" ! " decimal.Decimal.__gmpy_f__ = __gmpy_f__\n" ! "except: pass\n" ! ; ! PyObject* decimal_module = PyImport_ImportModule("decimal"); ! if(decimal_module) { PyObject* namespace = PyDict_New(); PyDict_SetItemString(namespace, "decimal", decimal_module); PyDict_SetItemString(namespace, "gmpy", gmpy_module); PyDict_SetItemString(namespace, "int", (PyObject*)&PyInt_Type); PyDict_SetItemString(namespace, "str", (PyObject*)&PyString_Type); ! PyObject* result = PyRun_String(tweak_decimal, Py_file_input, ! namespace, namespace); Py_DECREF(namespace); Py_XDECREF(result); --- 5954,5977 ---- /* Experimental: adapt module decimal to our needs */ ! decimal_module = PyImport_ImportModule("decimal"); ! if (decimal_module) { ! char* tweak_decimal = ! "def __gmpy_z__(self, f=gmpy.mpz): return f(int(self))\n" ! "def __gmpy_q__(self, f=gmpy.mpq): return f(str(self))\n" ! "def __gmpy_f__(self, f=gmpy.mpf): return f(str(self))\n" ! "try:\n" ! " decimal.Decimal.__gmpy_z__ = __gmpy_z__\n" ! " decimal.Decimal.__gmpy_q__ = __gmpy_q__\n" ! " decimal.Decimal.__gmpy_f__ = __gmpy_f__\n" ! "except: pass\n" ! ; PyObject* namespace = PyDict_New(); + PyObject* result = NULL; PyDict_SetItemString(namespace, "decimal", decimal_module); PyDict_SetItemString(namespace, "gmpy", gmpy_module); PyDict_SetItemString(namespace, "int", (PyObject*)&PyInt_Type); PyDict_SetItemString(namespace, "str", (PyObject*)&PyString_Type); ! result = PyRun_String(tweak_decimal, Py_file_input, ! namespace, namespace); Py_DECREF(namespace); Py_XDECREF(result); Index: gmpy.h =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gmpy.h 22 Apr 2006 16:28:19 -0000 1.6 --- gmpy.h 24 Feb 2007 00:00:50 -0000 1.7 *************** *** 5,9 **** Created by Pearu Peterson <pe...@ce...>, November 2000. Edited by A. Martelli <al...@ya...>, December 2000. ! Version 1.01, November 2005. */ --- 5,9 ---- Created by Pearu Peterson <pe...@ce...>, November 2000. Edited by A. Martelli <al...@ya...>, December 2000. ! Version 1.02, February 2007. */ |
From: Alex M. <al...@us...> - 2006-04-23 01:10:13
|
Update of /cvsroot/gmpy/gmpy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12314/src Modified Files: gmpy.c Log Message: Some local updates (on PPC Mac) Index: gmpy.c =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** gmpy.c 22 Apr 2006 23:31:30 -0000 1.24 --- gmpy.c 23 Apr 2006 01:10:11 -0000 1.25 *************** *** 130,133 **** --- 130,137 ---- * add support for __index__ in Python 2.5 * + * 1.03: + * add support for Py_ssize_t for compatibility with Python 2.5 + * add support for __index__ in Python 2.5 + * */ #include "pymemcompat.h" |
From: Alex M. <al...@us...> - 2006-04-22 23:31:37
|
Update of /cvsroot/gmpy/gmpy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17658/src Modified Files: gmpy.c Log Message: Fix setup.py for GMP 4.2 install on MacOSX 10.4 (look in /usr/local if needed); fix gmpy.c's randoms to be backwards compatible despite 4.2's changes to randoms; tweak tests to not demand quite as much identical-precision (digit by digit) of large numbers, since some last few digits change from GMP 4.1 to GMP 4.2; accept 4.2 among the GMP versions deemed OK in _test_cvr. Index: gmpy.c =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** gmpy.c 22 Apr 2006 16:28:19 -0000 1.23 --- gmpy.c 22 Apr 2006 23:31:30 -0000 1.24 *************** *** 5287,5290 **** --- 5287,5307 ---- static int randinited=0; static int randquality=0; + #if (__GNU_MP_VERSION==4) && (__GNU_MP_VERSION_MINOR>=2) + # define do_randinit(state, size) gmp_randinit_lc_2exp_size(state, size) + # define SEEDOF(x) ( *(mpz_t*)((x)->_mp_seed->_mp_d) ) + #else + # define do_randinit(state, size) gmp_randinit(state, GMP_RAND_ALG_LC, size) + # if (__GNU_MP_VERSION==4) + # define SEEDOF(x) ((x)->_mp_seed) + # else + # define SEEDOF(x) ((x)->seed) + # endif + #endif + + #if __GNU_MP__ >= 4 + #else + #endif + + static int randbits(PyObject* arg) { *************** *** 5301,5305 **** if(randinited) gmp_randclear(randstate); ! gmp_randinit(randstate, GMP_RAND_ALG_LC, size); randquality = size; randinited = 1; --- 5318,5322 ---- if(randinited) gmp_randclear(randstate); ! do_randinit(randstate, size); randquality = size; randinited = 1; *************** *** 5382,5390 **** PympzObject *resob = Pympz_new(); if(resob) { ! #if __GNU_MP__ >= 4 ! mpz_set(resob->z, randstate->_mp_seed); ! #else ! mpz_set(resob->z, randstate->seed); ! #endif result = (PyObject*)resob; } --- 5399,5403 ---- PympzObject *resob = Pympz_new(); if(resob) { ! mpz_set(resob->z, SEEDOF(randstate)); result = (PyObject*)resob; } |
From: Alex M. <al...@us...> - 2006-04-22 23:31:36
|
Update of /cvsroot/gmpy/gmpy/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17658/test Modified Files: gmpy_test_cvr.py gmpy_test_dec.py gmpy_test_mpf.py gmpy_test_mpq.py Log Message: Fix setup.py for GMP 4.2 install on MacOSX 10.4 (look in /usr/local if needed); fix gmpy.c's randoms to be backwards compatible despite 4.2's changes to randoms; tweak tests to not demand quite as much identical-precision (digit by digit) of large numbers, since some last few digits change from GMP 4.1 to GMP 4.2; accept 4.2 among the GMP versions deemed OK in _test_cvr. Index: gmpy_test_cvr.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_cvr.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gmpy_test_cvr.py 26 Feb 2006 07:36:59 -0000 1.7 --- gmpy_test_cvr.py 22 Apr 2006 23:31:30 -0000 1.8 *************** *** 3,7 **** # test-version 1.02 r''' ! >>> print int(_g.gmp_version() in ('4.1.4', '4.1.2', '4.0.1', '3.1.1')) 1 >>> _g.version() --- 3,7 ---- # test-version 1.02 r''' ! >>> print int(_g.gmp_version() in ('4.2', '4.1.4', '4.1.2', '4.0.1', '3.1.1')) 1 >>> _g.version() Index: gmpy_test_dec.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_dec.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gmpy_test_dec.py 22 Apr 2006 16:28:19 -0000 1.1 --- gmpy_test_dec.py 22 Apr 2006 23:31:30 -0000 1.2 *************** *** 45,50 **** >>> _g.getrprec(d) 53 ! >>> _g.fsqrt(d) ! mpf('3.51283361405005916059e0') >>> coerce(d, _g.mpf(1.0)) (mpf('1.234e1'), mpf('1.e0')) --- 45,50 ---- >>> _g.getrprec(d) 53 ! >>> _g.fsqrt(d)==_g.mpf(d).sqrt() ! 1 >>> coerce(d, _g.mpf(1.0)) (mpf('1.234e1'), mpf('1.e0')) Index: gmpy_test_mpf.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_mpf.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gmpy_test_mpf.py 26 Feb 2006 07:08:19 -0000 1.7 --- gmpy_test_mpf.py 22 Apr 2006 23:31:30 -0000 1.8 *************** *** 89,97 **** >>> _g.floor(-12.3)==math.floor(-12.3) 1 ! >>> (a**2).reldiff(float(a)**2) < (2.0**-(a.getrprec()-1)) 1 >>> (a**2).reldiff(a*a) < (2.0**-(a.getprec()-1)) 1 ! >>> (b**2).reldiff(float(b)**2) < (2.0**-(b.getrprec()-1)) 1 >>> (b**2).reldiff(b*b) < (2.0**-(b.getprec()-1)) --- 89,97 ---- >>> _g.floor(-12.3)==math.floor(-12.3) 1 ! >>> (a**2).reldiff(float(a)**2) < 1.03 * (2.0**-(a.getrprec()-1)) 1 >>> (a**2).reldiff(a*a) < (2.0**-(a.getprec()-1)) 1 ! >>> (b**2).reldiff(float(b)**2) < 1.03 * (2.0**-(b.getrprec()-1)) 1 >>> (b**2).reldiff(b*b) < (2.0**-(b.getprec()-1)) Index: gmpy_test_mpq.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_mpq.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gmpy_test_mpq.py 26 Feb 2006 07:36:59 -0000 1.8 --- gmpy_test_mpq.py 22 Apr 2006 23:31:30 -0000 1.9 *************** *** 88,99 **** >>> a//b mpq(0) ! >>> truediv(a,b) ! mpf('4.20502301380828497101e-2') >>> b/a mpq(39976,1681) >>> b//a mpq(23) ! >>> truediv(b,a) ! mpf('2.37810826888756692443e1') >>> ''' --- 88,99 ---- >>> a//b mpq(0) ! >>> truediv(a,b).digits(10,19) ! '4.205023013808284971e-2' >>> b/a mpq(39976,1681) >>> b//a mpq(23) ! >>> truediv(b,a).digits(10,19) ! '2.378108268887566924e1' >>> ''' |
From: Alex M. <al...@us...> - 2006-04-22 23:31:36
|
Update of /cvsroot/gmpy/gmpy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17658 Modified Files: setup.py Log Message: Fix setup.py for GMP 4.2 install on MacOSX 10.4 (look in /usr/local if needed); fix gmpy.c's randoms to be backwards compatible despite 4.2's changes to randoms; tweak tests to not demand quite as much identical-precision (digit by digit) of large numbers, since some last few digits change from GMP 4.1 to GMP 4.2; accept 4.2 among the GMP versions deemed OK in _test_cvr. Index: setup.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/setup.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** setup.py 22 Apr 2006 16:32:50 -0000 1.8 --- setup.py 22 Apr 2006 23:31:30 -0000 1.9 *************** *** 11,15 **** # determine include and library dirs incdirs = libdirs = () ! if sys.version.find('MSC') != -1: # Unix-like build incdirs = ['./src'] --- 11,15 ---- # determine include and library dirs incdirs = libdirs = () ! if sys.version.find('MSC') == -1: # Unix-like build incdirs = ['./src'] |
From: Alex M. <al...@us...> - 2006-04-22 16:32:55
|
Update of /cvsroot/gmpy/gmpy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14096 Modified Files: setup.py Log Message: Determine include and library dirs properly Index: setup.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/setup.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** setup.py 22 Apr 2006 16:28:19 -0000 1.7 --- setup.py 22 Apr 2006 16:32:50 -0000 1.8 *************** *** 9,23 **** DistributionMetadata.download_url = None ! if sys.version.find('MSC')==-1: ! gmpy_ext = Extension('gmpy', sources=['src/gmpy.c'], ! # library_dirs=['/usr/local/lib'], ! libraries=['gmp']) ! else: incdirs = ['./src'] if os.path.isfile('/usr/local/include/gmp.h'): incdirs.append('/usr/local/include') ! gmpy_ext = Extension('gmpy', sources=['src/gmpy.c'], ! include_dirs=incdirs, ! libraries=['gmp']) setup (name = "gmpy", --- 9,27 ---- DistributionMetadata.download_url = None ! # determine include and library dirs ! incdirs = libdirs = () ! if sys.version.find('MSC') != -1: ! # Unix-like build incdirs = ['./src'] if os.path.isfile('/usr/local/include/gmp.h'): incdirs.append('/usr/local/include') ! if os.path.isfile('/usr/local/lib/libgmp.a'): ! libdirs=['/usr/local/lib'] ! ! # prepare the extension for building ! gmpy_ext = Extension('gmpy', sources=['src/gmpy.c'], ! include_dirs=incdirs, ! library_dirs=libdirs, ! libraries=['gmp']) setup (name = "gmpy", |
From: Alex M. <al...@us...> - 2006-04-22 16:29:15
|
Update of /cvsroot/gmpy/gmpy/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11215/test Added Files: gmpy_test_dec.py Log Message: Test the monkeypatching of decimal.Decimal --- NEW FILE: gmpy_test_dec.py --- # partial unit test for gmpy/decimal interoperability # relies on Tim Peters' "doctest.py" test-driver # test-version 1.02 r''' >>> dir(f) ['_copy', 'binary', 'ceil', 'digits', 'f2q', 'floor', 'getprec', 'getrprec', 'qdiv', 'reldiff', 'setprec', 'sign', 'sqrt', 'trunc'] >>> ''' try: import decimal as _d except ImportError: _d = None import gmpy as _g, doctest, sys __test__={} f=_g.mpf('123.456') q=_g.mpq('789123/1000') z=_g.mpz('234') if _d: d=_d.Decimal('12.34') __test__['elemop']=\ r''' >>> print _g.mpz(d) 12 >>> print _g.mpq(d) 617/50 >>> print _g.mpf(d) 12.34 >>> print f+d 135.796 >>> print d+f 135.796 >>> print q+d 801463/1000 >>> print d+q 801463/1000 >>> print z+d 246 >>> print d+z 246 >>> print _g.ceil(d) 13.0 >>> print _g.floor(d) 12.0 >>> print _g.trunc(d) 12.0 >>> _g.getrprec(d) 53 >>> _g.fsqrt(d) mpf('3.51283361405005916059e0') >>> coerce(d, _g.mpf(1.0)) (mpf('1.234e1'), mpf('1.e0')) >>> ''' def _test(chat=None): if chat: print "Unit tests for gmpy 1.1 release candidate (decimal interoperation)" print " running on Python",sys.version print print "Testing gmpy %s (GMP %s) with default caching (%s, %s, %s..%s)" % ( (_g.version(), _g.gmp_version(), _g.get_zcache(), _g.get_qcache(), ) + _g.get_zconst()) if not _d: if chat: print "Can't test, since can't import decimal" return 0, 0 thismod = sys.modules.get(__name__) doctest.testmod(thismod, report=0) if chat: print print "Overall results for dec:" return doctest.master.summarize(chat) if __name__=='__main__': _test(1) |
From: Alex M. <al...@us...> - 2006-04-22 16:28:24
|
Update of /cvsroot/gmpy/gmpy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11215/src Modified Files: gmpy.c gmpy.h Log Message: Test the monkeypatching of decimal.Decimal Index: gmpy.c =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** gmpy.c 30 Mar 2006 00:57:34 -0000 1.22 --- gmpy.c 22 Apr 2006 16:28:19 -0000 1.23 *************** *** 126,129 **** --- 126,133 ---- * two bugfixes, thanks to Simon Burton * + * 1.03: + * add support for Py_ssize_t for compatibility with Python 2.5 + * add support for __index__ in Python 2.5 + * */ #include "pymemcompat.h" *************** *** 370,374 **** PyObject *funky_arg=0, *extype, *exvalue, *extb; int i; ! int tlen = PyTuple_Size(args); if(tlen<min || tlen>max) return 0; PyErr_Fetch(&extype, &exvalue, &extb); --- 374,378 ---- PyObject *funky_arg=0, *extype, *exvalue, *extb; int i; ! Py_ssize_t tlen = PyTuple_Size(args); if(tlen<min || tlen>max) return 0; PyErr_Fetch(&extype, &exvalue, &extb); *************** *** 1054,1058 **** PympzObject *newob; unsigned char *cp; ! int len, i; assert(PyString_Check(s)); --- 1058,1063 ---- PympzObject *newob; unsigned char *cp; ! Py_ssize_t len; ! int i; assert(PyString_Check(s)); *************** *** 1123,1127 **** PympqObject *newob; unsigned char *cp; ! int len, i; assert(PyString_Check(stringarg)); --- 1128,1133 ---- PympqObject *newob; unsigned char *cp; ! Py_ssize_t len; ! int i; assert(PyString_Check(stringarg)); *************** *** 1256,1260 **** PympfObject *newob; unsigned char *cp; ! int precision, len, i; assert(PyString_Check(s)); --- 1262,1267 ---- PympfObject *newob; unsigned char *cp; ! Py_ssize_t len; ! int precision, i; assert(PyString_Check(s)); *************** *** 1453,1456 **** --- 1460,1475 ---- } + #if Py_TPFLAGS_HAVE_INDEX + static Py_ssize_t + Pympz_asindex(PympzObject *x) + { + if(notanint(x->z)) { + PyErr_SetString(PyExc_OverflowError, "mpz too large for ssize_t"); + return 0; + } + return mpz_get_si(x->z); + } + #endif + /* * mpf->int delegates via mpf->mpz->int for convenience; ditto mpq->int *************** *** 3152,3156 **** PympzObject *newob; PyObject *obj; ! int argc; if(options.debug) --- 3171,3175 ---- PympzObject *newob; PyObject *obj; ! Py_ssize_t argc; if(options.debug) *************** *** 5466,5469 **** --- 5485,5491 ---- 0, /* binaryfunc nb_inplace_floor_divide; */ 0, /* binaryfunc nb_inplace_true_divide; */ + #if Py_TPFLAGS_HAVE_INDEX + (lenfunc) Pympz_asindex, /* lenfunc nb_index; */ + #endif }; *************** *** 5722,5726 **** (setattrofunc) 0, /* tp_setattro */ (PyBufferProcs *) 0, /* tp_as_buffer */ ! 0, /* Py_TPFLAGS_HAVE_INPLACEOPS, tp_flags */ "GNU Multi Precision signed integer", }; --- 5744,5748 ---- (setattrofunc) 0, /* tp_setattro */ (PyBufferProcs *) 0, /* tp_as_buffer */ ! Py_TPFLAGS_HAVE_INDEX, /* tp_flags */ "GNU Multi Precision signed integer", }; Index: gmpy.h =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gmpy.h 30 Mar 2006 00:57:34 -0000 1.5 --- gmpy.h 22 Apr 2006 16:28:19 -0000 1.6 *************** *** 24,27 **** --- 24,35 ---- #include "gmp.h" + /* ensure 2.5 compatibility */ + #if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #endif + #ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 + #endif + /* Header file for gmpy */ |
From: Alex M. <al...@us...> - 2006-04-22 16:28:23
|
Update of /cvsroot/gmpy/gmpy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11215 Modified Files: setup.py Log Message: Test the monkeypatching of decimal.Decimal Index: setup.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/setup.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** setup.py 11 Nov 2005 21:52:23 -0000 1.6 --- setup.py 22 Apr 2006 16:28:19 -0000 1.7 *************** *** 1,3 **** ! import sys from distutils.core import setup, Extension --- 1,3 ---- ! import sys, os from distutils.core import setup, Extension *************** *** 14,19 **** libraries=['gmp']) else: gmpy_ext = Extension('gmpy', sources=['src/gmpy.c'], ! include_dirs=['./src'], libraries=['gmp']) --- 14,22 ---- libraries=['gmp']) else: + incdirs = ['./src'] + if os.path.isfile('/usr/local/include/gmp.h'): + incdirs.append('/usr/local/include') gmpy_ext = Extension('gmpy', sources=['src/gmpy.c'], ! include_dirs=incdirs, libraries=['gmp']) |
From: Alex M. <al...@us...> - 2006-03-30 00:57:38
|
Update of /cvsroot/gmpy/gmpy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21338/src Modified Files: gmpy.c gmpy.h Log Message: Fixes by Simon Button Index: gmpy.c =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** gmpy.c 26 Feb 2006 07:38:51 -0000 1.21 --- gmpy.c 30 Mar 2006 00:57:34 -0000 1.22 *************** *** 124,127 **** --- 124,128 ---- * via wider use of special conversion methods (if present) and their * sly insertion on-the-fly into the decimal.Decimal class (!) + * two bugfixes, thanks to Simon Burton * */ *************** *** 1930,1933 **** --- 1931,1935 ---- if(!*buffer) { /* need to use malloc here for uniformity with mpf_get_str */ + free(buffer); buffer = malloc(2); strcpy(buffer, "0"); Index: gmpy.h =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gmpy.h 7 Nov 2005 04:07:04 -0000 1.4 --- gmpy.h 30 Mar 2006 00:57:34 -0000 1.5 *************** *** 146,156 **** static void **Pygmpy_API; ! #define Pypmz_Check(op) \ ((op)->ob_type == (PyTypeObject *)Pygmpy_API[Pympz_Type_NUM]) #define Pympz_Type (*(PyTypeObject *)Pygmpy_API[Pympz_Type_NUM]) ! #define Pypmq_Check(op) \ ((op)->ob_type == (PyTypeObject *)Pygmpy_API[Pympq_Type_NUM]) #define Pympq_Type (*(PyTypeObject *)Pygmpy_API[Pympq_Type_NUM]) ! #define Pypmf_Check(op) \ ((op)->ob_type == (PyTypeObject *)Pygmpy_API[Pympf_Type_NUM]) #define Pympf_Type (*(PyTypeObject *)Pygmpy_API[Pympf_Type_NUM]) --- 146,156 ---- static void **Pygmpy_API; ! #define Pympz_Check(op) \ ((op)->ob_type == (PyTypeObject *)Pygmpy_API[Pympz_Type_NUM]) #define Pympz_Type (*(PyTypeObject *)Pygmpy_API[Pympz_Type_NUM]) ! #define Pympq_Check(op) \ ((op)->ob_type == (PyTypeObject *)Pygmpy_API[Pympq_Type_NUM]) #define Pympq_Type (*(PyTypeObject *)Pygmpy_API[Pympq_Type_NUM]) ! #define Pympf_Check(op) \ ((op)->ob_type == (PyTypeObject *)Pygmpy_API[Pympf_Type_NUM]) #define Pympf_Type (*(PyTypeObject *)Pygmpy_API[Pympf_Type_NUM]) |
From: Alex M. <al...@us...> - 2006-02-26 07:38:56
|
Update of /cvsroot/gmpy/gmpy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25277/src Modified Files: gmpy.c Log Message: Added mention of dmcooke's 64-bit patch in gmpy.c's leading comment Index: gmpy.c =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** gmpy.c 26 Feb 2006 07:36:59 -0000 1.20 --- gmpy.c 26 Feb 2006 07:38:51 -0000 1.21 *************** *** 120,123 **** --- 120,124 ---- * fix warning in comparison of mpq's * added support of mpq('12.34') [[string w/o a slash, but with a dot]] + * fixes for 64-bit build (thanks to a patch by dmcooke) * added experimental support for decimal.Decimal (and user-coded types) * via wider use of special conversion methods (if present) and their |
From: Alex M. <al...@us...> - 2006-02-26 07:37:06
|
Update of /cvsroot/gmpy/gmpy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24545/src Modified Files: gmpy.c Log Message: Added fixes for 64-bit build (from dmcooke's patch) Index: gmpy.c =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** gmpy.c 26 Feb 2006 07:08:18 -0000 1.19 --- gmpy.c 26 Feb 2006 07:36:59 -0000 1.20 *************** *** 167,177 **** static struct gmpy_options { ! long debug; /* != 0 if debug messages desired on stderr */ unsigned long minprec; /* min #of bits' precision on new mpf's built */ ! long tagoff; /* 0 for full tags 'gmpy.mpz()', else 5 for 'mpz()' */ ! long zcache; /* size of cache for mpz objects */ ! long minzco; /* min mpz that will come as constant (inclusive) */ ! 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 --- 167,177 ---- static struct gmpy_options { ! int debug; /* != 0 if debug messages desired on stderr */ unsigned long minprec; /* min #of bits' precision on new mpf's built */ ! int tagoff; /* 0 for full tags 'gmpy.mpz()', else 5 for 'mpz()' */ ! int zcache; /* size of cache for mpz objects */ ! int minzco; /* min mpz that will come as constant (inclusive) */ ! int maxzco; /* max mpz that will come as constant (exclusive) */ ! int 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 *************** *** 186,190 **** 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 }; /* sanity check: do NOT let cache sizes become wildly large! */ --- 186,190 ---- 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, 0 }; /* sanity check: do NOT let cache sizes become wildly large! */ *************** *** 237,241 **** } else { \ if(options.debug) \ ! fprintf(stderr, "Not placing in full zcache(%d/%ld)\n", \ in_zcache, options.zcache); \ mpz_clear(oldo); \ --- 237,241 ---- } else { \ if(options.debug) \ ! fprintf(stderr, "Not placing in full zcache(%d/%d)\n", \ in_zcache, options.zcache); \ mpz_clear(oldo); \ *************** *** 304,308 **** } else { \ if(options.debug) \ ! fprintf(stderr, "Not placing in full qcache(%d/%ld)\n", \ in_qcache, options.qcache); \ mpq_clear(oldo); \ --- 304,308 ---- } else { \ if(options.debug) \ ! fprintf(stderr, "Not placing in full qcache(%d/%d)\n", \ in_qcache, options.qcache); \ mpq_clear(oldo); \ *************** *** 658,664 **** Pygmpy_set_tagoff(PyObject *self, PyObject *args) { ! long old = options.tagoff; ! ONE_ARG("set_tagoff", "l", &options.tagoff); if(options.tagoff) options.tagoff=5; return Py_BuildValue("i", old!=0); --- 658,664 ---- Pygmpy_set_tagoff(PyObject *self, PyObject *args) { ! int old = options.tagoff; ! ONE_ARG("set_tagoff", "i", &options.tagoff); if(options.tagoff) options.tagoff=5; return Py_BuildValue("i", old!=0); *************** *** 676,680 **** int i; ! ONE_ARG("set_minprec", "l", &i); if(i<0) { PyErr_SetString(PyExc_ValueError, --- 676,680 ---- int i; ! ONE_ARG("set_minprec", "i", &i); if(i<0) { PyErr_SetString(PyExc_ValueError, *************** *** 808,818 **** { PympfObject *newob; assert(PyInt_Check(i)); ! if(!bits) bits = SIZEOF_LONG*8; if(!(newob = Pympf_new(bits))) return NULL; ! mpf_set_si(newob->f, PyInt_AsLong(i)); return newob; } --- 808,829 ---- { PympfObject *newob; + long li; assert(PyInt_Check(i)); ! li = PyInt_AsLong(i); ! /* on a 64-bit machine, SIZEOF_LONG*8 > double_mantissa, so to simplify ! the representation, only use that many bits if we have an integer that ! won't fit in an int. */ ! if(!bits) { ! if ((li > INT_MAX) || (li < (-INT_MAX-1))) { ! bits = SIZEOF_LONG*8; ! } else { ! bits = SIZEOF_INT*8; ! } ! } if(!(newob = Pympf_new(bits))) return NULL; ! mpf_set_si(newob->f, li); return newob; } *************** *** 1141,1144 **** --- 1152,1159 ---- numerator = str2mpz(s,256); Py_DECREF(s); + if (!numerator) { + Py_DECREF((PyObject*)newob); + return 0; + } if(mpz_sgn(numerator->z) < 0) { PyErr_SetString(PyExc_ValueError, "invalid mpq binary (num sgn)"); *************** *** 1152,1155 **** --- 1167,1175 ---- denominator = str2mpz(s,256); Py_DECREF(s); + if (!denominator) { + Py_DECREF((PyObject*)newob); + Py_DECREF((PyObject*)numerator); + return 0; + } if(mpz_sgn(denominator->z) != 1) { PyErr_SetString(PyExc_ValueError, "invalid mpq binary (den sgn)"); *************** *** 1490,1494 **** { mpz_t temp; ! int size, usize, negative, i, needtrail; char *buffer; PyObject *s; --- 1510,1515 ---- { mpz_t temp; ! size_t size, usize; ! int negative, i, needtrail; char *buffer; PyObject *s; *************** *** 2154,2158 **** if(options.debug) fprintf(stderr, "anynum2mpf(%p,%d)->%p (%d)\n", obj, ! bits, newob, newob?newob->rebits:-1); return newob; --- 2175,2179 ---- if(options.debug) fprintf(stderr, "anynum2mpf(%p,%d)->%p (%d)\n", obj, ! bits, newob, newob != 0 ? newob->rebits : -1); return newob; *************** *** 2281,2286 **** { PyObject *s; ! int bits=0; ! SELF_ONE_ARG("mpf_copy", Pympf_convert_arg,"|i",&bits); assert(Pympf_Check(self)); --- 2302,2307 ---- { PyObject *s; ! unsigned int bits=0; ! SELF_ONE_ARG("mpf_copy", Pympf_convert_arg,"|I",&bits); assert(Pympf_Check(self)); *************** *** 2389,2393 **** Pympz_digits(PyObject *self, PyObject *args) { ! long base = 10; PyObject *s; --- 2410,2414 ---- Pympz_digits(PyObject *self, PyObject *args) { ! int base = 10; PyObject *s; *************** *** 2418,2422 **** Pympz_numdigits(PyObject *self, PyObject *args) { ! long base = 10; PyObject *s; --- 2439,2443 ---- Pympz_numdigits(PyObject *self, PyObject *args) { ! int base = 10; PyObject *s; *************** *** 2429,2433 **** return NULL; } ! s = Py_BuildValue("i", mpz_sizeinbase(Pympz_AS_MPZ(self), base)); Py_DECREF(self); return s; --- 2450,2454 ---- return NULL; } ! s = Py_BuildValue("l", (long) mpz_sizeinbase(Pympz_AS_MPZ(self), base)); Py_DECREF(self); return s; *************** *** 2449,2453 **** Pympq_digits(PyObject *self, PyObject *args) { ! long base = 10; PyObject *s; --- 2470,2474 ---- Pympq_digits(PyObject *self, PyObject *args) { ! int base = 10; PyObject *s; *************** *** 2481,2485 **** PyObject *s; ! SELF_ONE_ARG("scan0",Pympz_convert_arg,"|i",&starting_bit); assert(Pympz_Check(self)); if(starting_bit < 0) { --- 2502,2506 ---- PyObject *s; ! SELF_ONE_ARG("scan0",Pympz_convert_arg,"|l",&starting_bit); assert(Pympz_Check(self)); if(starting_bit < 0) { *************** *** 2487,2491 **** if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOi", "scan0", msg, self, starting_bit); PyErr_SetString(PyExc_ValueError, msg); return NULL; --- 2508,2512 ---- if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOl", "scan0", msg, self, starting_bit); PyErr_SetString(PyExc_ValueError, msg); return NULL; *************** *** 2501,2507 **** s = Py_BuildValue(""); else ! s = Py_BuildValue("i", starting_bit); } else { ! s = Py_BuildValue("i", mpz_scan0(Pympz_AS_MPZ(self), starting_bit)); } Py_DECREF(self); --- 2522,2528 ---- s = Py_BuildValue(""); else ! s = Py_BuildValue("l", starting_bit); } else { ! s = Py_BuildValue("l", mpz_scan0(Pympz_AS_MPZ(self), starting_bit)); } Py_DECREF(self); *************** *** 2529,2533 **** PyObject *s; ! SELF_ONE_ARG("scan1",Pympz_convert_arg,"|i",&starting_bit); assert(Pympz_Check(self)); if(starting_bit < 0) { --- 2550,2554 ---- PyObject *s; ! SELF_ONE_ARG("scan1",Pympz_convert_arg,"|l",&starting_bit); assert(Pympz_Check(self)); if(starting_bit < 0) { *************** *** 2535,2539 **** if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOi", "scan1", msg, self, starting_bit); PyErr_SetString(PyExc_ValueError, msg); return NULL; --- 2556,2560 ---- if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOl", "scan1", msg, self, starting_bit); PyErr_SetString(PyExc_ValueError, msg); return NULL; *************** *** 2549,2555 **** s = Py_BuildValue(""); else ! s = Py_BuildValue("i", starting_bit); } else { ! s = Py_BuildValue("i", mpz_scan1(Pympz_AS_MPZ(self), starting_bit)); } Py_DECREF(self); --- 2570,2576 ---- s = Py_BuildValue(""); else ! s = Py_BuildValue("l", starting_bit); } else { ! s = Py_BuildValue("l", mpz_scan1(Pympz_AS_MPZ(self), starting_bit)); } Py_DECREF(self); *************** *** 2574,2578 **** SELF_NO_ARG("popcount", Pympz_convert_arg); assert(Pympz_Check(self)); ! s = Py_BuildValue("i", mpz_popcount(Pympz_AS_MPZ(self))); Py_DECREF(self); return s; --- 2595,2599 ---- SELF_NO_ARG("popcount", Pympz_convert_arg); assert(Pympz_Check(self)); ! s = Py_BuildValue("l", mpz_popcount(Pympz_AS_MPZ(self))); Py_DECREF(self); return s; *************** *** 2595,2599 **** PympzObject *s; ! SELF_ONE_ARG("lowbits", Pympz_convert_arg,"i",&nbits); assert(Pympz_Check(self)); if(nbits <= 0) { --- 2616,2620 ---- PympzObject *s; ! SELF_ONE_ARG("lowbits", Pympz_convert_arg,"l",&nbits); assert(Pympz_Check(self)); if(nbits <= 0) { *************** *** 2601,2605 **** if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOi", "lowbits", msg, self, nbits); PyErr_SetString(PyExc_ValueError, msg); return NULL; --- 2622,2626 ---- if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOl", "lowbits", msg, self, nbits); PyErr_SetString(PyExc_ValueError, msg); return NULL; *************** *** 2628,2632 **** PyObject *s; ! SELF_ONE_ARG("getbit", Pympz_convert_arg,"i",&bit_index); assert(Pympz_Check(self)); if(bit_index < 0) { --- 2649,2653 ---- PyObject *s; ! SELF_ONE_ARG("getbit", Pympz_convert_arg,"l",&bit_index); assert(Pympz_Check(self)); if(bit_index < 0) { *************** *** 2634,2638 **** if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOi", "getbit", msg, self, bit_index); PyErr_SetString(PyExc_ValueError, msg); return NULL; --- 2655,2659 ---- if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOl", "getbit", msg, self, bit_index); PyErr_SetString(PyExc_ValueError, msg); return NULL; *************** *** 2660,2668 **** if(self) { ! if(!PyArg_ParseTuple(args, "i|i", &bit_index, &bit_value)) return last_try_self("setbit", 1, 2, args, self); Py_INCREF(self); } else { ! if(!PyArg_ParseTuple(args, "O&i|i", Pympz_convert_arg, &self, &bit_index, &bit_value)) return last_try("setbit", 2, 3, args); --- 2681,2689 ---- if(self) { ! if(!PyArg_ParseTuple(args, "l|l", &bit_index, &bit_value)) return last_try_self("setbit", 1, 2, args, self); Py_INCREF(self); } else { ! if(!PyArg_ParseTuple(args, "O&l|l", Pympz_convert_arg, &self, &bit_index, &bit_value)) return last_try("setbit", 2, 3, args); *************** *** 2673,2677 **** if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOi", "setbit", msg, self, bit_index); PyErr_SetString(PyExc_ValueError, msg); return NULL; --- 2694,2698 ---- if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOl", "setbit", msg, self, bit_index); PyErr_SetString(PyExc_ValueError, msg); return NULL; *************** *** 2709,2713 **** PympzObject *s; ! SELF_ONE_ARG("mpz_root", Pympz_convert_arg,"i",&n); assert(Pympz_Check(self)); if(n <= 0) { --- 2730,2734 ---- PympzObject *s; ! SELF_ONE_ARG("mpz_root", Pympz_convert_arg,"l",&n); assert(Pympz_Check(self)); if(n <= 0) { *************** *** 2715,2719 **** if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOi", "mpz_root", msg, self, n); PyErr_SetString(PyExc_ValueError, msg); return NULL; --- 2736,2740 ---- if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOl", "mpz_root", msg, self, n); PyErr_SetString(PyExc_ValueError, msg); return NULL; *************** *** 2724,2728 **** if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOi", "mpz_root", msg, self, n); PyErr_SetString(PyExc_ValueError, msg); return NULL; --- 2745,2749 ---- if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssOl", "mpz_root", msg, self, n); PyErr_SetString(PyExc_ValueError, msg); return NULL; *************** *** 2779,2787 **** Pympf_digits(PyObject *self, PyObject *args) { ! long base = 10; ! long digs = 0; ! long mine = 0; ! long maxe = -1; ! long opts = 0; PyObject *s; --- 2800,2808 ---- Pympf_digits(PyObject *self, PyObject *args) { ! int base = 10; ! int digs = 0; ! int mine = 0; ! int maxe = -1; ! int opts = 0; PyObject *s; *************** *** 3162,3165 **** --- 3183,3189 ---- } newob = str2mpz(obj, base); + if (!newob) { + return NULL; + } } else { if(argc==2) { *************** *** 3240,3243 **** --- 3264,3270 ---- } newob = str2mpq(obj, base); + if (!newob) { + return NULL; + } } else { wasnumeric=1; *************** *** 3360,3363 **** --- 3387,3393 ---- } newob = str2mpf(obj, base, bits); + if (!newob) { + return NULL; + } } else { if(argc==3) { *************** *** 4500,4504 **** if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssi", "fac", msg, n); PyErr_SetString(PyExc_ValueError, msg); return NULL; --- 4530,4534 ---- if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssl", "fac", msg, n); PyErr_SetString(PyExc_ValueError, msg); return NULL; *************** *** 4527,4531 **** if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssi", "fib", msg, n); PyErr_SetString(PyExc_ValueError, msg); return NULL; --- 4557,4561 ---- if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssl", "fib", msg, n); PyErr_SetString(PyExc_ValueError, msg); return NULL; *************** *** 4639,4643 **** long k; ! SELF_ONE_ARG("bincoef", Pympz_convert_arg,"i",&k); assert(Pympz_Check(self)); --- 4669,4673 ---- long k; ! SELF_ONE_ARG("bincoef", Pympz_convert_arg,"l",&k); assert(Pympz_Check(self)); *************** *** 4647,4651 **** if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssNi", "bincoef", msg, self, k); PyErr_SetString(PyExc_ValueError, msg); Py_DECREF(self); --- 4677,4681 ---- if(options.ER_cb) return PyObject_CallFunction(options.ER_cb, ! "ssNl", "bincoef", msg, self, k); PyErr_SetString(PyExc_ValueError, msg); Py_DECREF(self); *************** *** 5111,5115 **** Pympf_getprec(PyObject *self, PyObject *args) { ! int precres; SELF_NO_ARG("getprec", Pympf_convert_arg); --- 5141,5145 ---- Pympf_getprec(PyObject *self, PyObject *args) { ! unsigned long precres; SELF_NO_ARG("getprec", Pympf_convert_arg); *************** *** 5118,5122 **** precres = mpf_get_prec(Pympf_AS_MPF(self)); Py_DECREF(self); ! return Py_BuildValue("i", precres); } --- 5148,5152 ---- precres = mpf_get_prec(Pympf_AS_MPF(self)); Py_DECREF(self); ! return Py_BuildValue("l", precres); } *************** *** 5150,5159 **** Pympf_setprec(PyObject *self, PyObject *args) { ! int precres; assert(self); /* exists _as method, ONLY_ */ assert(Pympf_Check(self)); ! ONE_ARG("setprec", "i", &precres); if(precres<0) { PyErr_SetString(PyExc_ValueError, "n must be >=0"); --- 5180,5189 ---- Pympf_setprec(PyObject *self, PyObject *args) { ! long precres; assert(self); /* exists _as method, ONLY_ */ assert(Pympf_Check(self)); ! ONE_ARG("setprec", "l", &precres); if(precres<0) { PyErr_SetString(PyExc_ValueError, "n must be >=0"); |
From: Alex M. <al...@us...> - 2006-02-26 07:37:05
|
Update of /cvsroot/gmpy/gmpy/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24545/test Modified Files: gmpy_test.py gmpy_test_cvr.py gmpy_test_mpq.py gmpy_test_mpz.py Log Message: Added fixes for 64-bit build (from dmcooke's patch) Index: gmpy_test.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gmpy_test.py 26 Feb 2006 07:08:18 -0000 1.7 --- gmpy_test.py 26 Feb 2006 07:36:59 -0000 1.8 *************** *** 34,39 **** pf, pt = 0, 0 for x in test_modules: print x.__name__, - failures, tests = x._test() print "%3d tests, %d failures" % (tests-pt, failures-pf) pf, pt = failures, tests --- 34,41 ---- pf, pt = 0, 0 for x in test_modules: + testit = x._test() + failures, tests = testit + if tests == 0: continue print x.__name__, print "%3d tests, %d failures" % (tests-pt, failures-pf) pf, pt = failures, tests Index: gmpy_test_cvr.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_cvr.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gmpy_test_cvr.py 26 Feb 2006 07:08:19 -0000 1.6 --- gmpy_test_cvr.py 26 Feb 2006 07:36:59 -0000 1.7 *************** *** 170,174 **** File "<stdin>", line 1, in ? ValueError: invalid digits ! >>> int(_g.mpz(1000*1000*1000*1000L)) Traceback (most recent call last): File "<stdin>", line 1, in ? --- 170,174 ---- File "<stdin>", line 1, in ? ValueError: invalid digits ! >>> int(_g.mpz(1000L*1000*1000*1000*1000*1000*1000)) Traceback (most recent call last): File "<stdin>", line 1, in ? *************** *** 348,352 **** File "<stdin>", line 1, in ? ValueError: mpz.pow with negative power ! >>> _g.mpz(2)**_g.mpz(1000000*1000000L) Traceback (most recent call last): File "<stdin>", line 1, in ? --- 348,352 ---- File "<stdin>", line 1, in ? ValueError: mpz.pow with negative power ! >>> _g.mpz(2)**_g.mpz(1000000*10000000000000L) Traceback (most recent call last): File "<stdin>", line 1, in ? *************** *** 362,366 **** File "<stdin>", line 1, in ? ValueError: mpq.pow no modulo allowed ! >>> a=1000000L**2 >>> _g.mpq(2)**a Traceback (most recent call last): --- 362,366 ---- File "<stdin>", line 1, in ? ValueError: mpq.pow no modulo allowed ! >>> a=10000000000L**2 >>> _g.mpq(2)**a Traceback (most recent call last): Index: gmpy_test_mpq.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_mpq.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gmpy_test_mpq.py 26 Feb 2006 07:08:19 -0000 1.7 --- gmpy_test_mpq.py 26 Feb 2006 07:36:59 -0000 1.8 *************** *** 213,222 **** >>> a.digits(30) '1b/52' ! >>> _g.mpq(1000*1000*1000*1000L,23) ! mpq(1000000000000L,23) ! >>> _g.mpq(23,1000*1000*1000*1000L) ! mpq(23,1000000000000L) ! >>> _g.mpq(23L**10L,1000L**4L) ! mpq(41426511213649L,1000000000000L) >>> _g.qbinary('pep') Traceback (most recent call last): --- 213,222 ---- >>> a.digits(30) '1b/52' ! >>> _g.mpq(1000L*1000*1000*1000*1000*1000*1000,23) ! mpq(1000000000000000000000L,23) ! >>> _g.mpq(23,1000L*1000*1000*1000*1000*1000*1000) ! mpq(23,1000000000000000000000L) ! >>> _g.mpq(23L**15L,1000L**7L) ! mpq(266635235464391245607L,1000000000000000000000L) >>> _g.qbinary('pep') Traceback (most recent call last): Index: gmpy_test_mpz.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_mpz.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gmpy_test_mpz.py 26 Feb 2006 07:08:19 -0000 1.11 --- gmpy_test_mpz.py 26 Feb 2006 07:36:59 -0000 1.12 *************** *** 81,86 **** >>> abs(-a)==a 1 ! >>> pow(a,7) ! mpz(425927596977747L) >>> pow(a,7,b) mpz(99) --- 81,86 ---- >>> abs(-a)==a 1 ! >>> pow(a,10) ! mpz(792594609605189126649L) >>> pow(a,7,b) mpz(99) *************** *** 160,166 **** >>> _g.mpz(-23L) mpz(-23) ! >>> x=1000*1000*1000*1000L >>> _g.mpz(x) ! mpz(1000000000000L) >>> try: print cmp(_g.mpz(1), _g.mpz(-1)) ... except: print 'ouch!' --- 160,166 ---- >>> _g.mpz(-23L) mpz(-23) ! >>> x=1000L*1000*1000*1000*1000*1000*1000 >>> _g.mpz(x) ! mpz(1000000000000000000000L) >>> try: print cmp(_g.mpz(1), _g.mpz(-1)) ... except: print 'ouch!' *************** *** 540,545 **** a.kronecker(3, 4) TypeError: function takes exactly 1 argument (2 given) ! >>> a=1000000L**2 ! >>> b=a+1 >>> _g.jacobi(a,b) 1 --- 540,545 ---- a.kronecker(3, 4) TypeError: function takes exactly 1 argument (2 given) ! >>> a=10L**20 ! >>> b=a+39 >>> _g.jacobi(a,b) 1 |
From: Alex M. <al...@us...> - 2006-02-26 07:08:23
|
Update of /cvsroot/gmpy/gmpy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12984/src Modified Files: gmpy.c Log Message: Added experimental support for decimal.Decimal, etc - version now 1.02 (rc) Index: gmpy.c =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** gmpy.c 26 Feb 2006 06:44:19 -0000 1.18 --- gmpy.c 26 Feb 2006 07:08:18 -0000 1.19 *************** *** 9,12 **** --- 9,13 ---- * cleanups & reorgs leading to 1.0: Alex Martelli (until Aug 2003) * further cleanups and bugfixes leading to 1.01, Alex Martelli (Nov 2005) + * minor bugfixes+new decimal (&c) support to 1.02, Alex Martelli (Feb 2006) * * Some hacks by Gustavo Niemeyer <nie...@co...>. *************** *** 105,109 **** * 1.0: * minor cleanups, ensure support for Python 2.3 ! * fixed misdiagnosis of some argument couns in macro * SELF_ONE_ARG_CONVERTED (tx to Paul Rubin!) * --- 106,110 ---- * 1.0: * minor cleanups, ensure support for Python 2.3 ! * fixed misdiagnosis of some argument counts in macro * SELF_ONE_ARG_CONVERTED (tx to Paul Rubin!) * *************** *** 118,121 **** --- 119,126 ---- * 1.02: * fix warning in comparison of mpq's + * added support of mpq('12.34') [[string w/o a slash, but with a dot]] + * added experimental support for decimal.Decimal (and user-coded types) + * via wider use of special conversion methods (if present) and their + * sly insertion on-the-fly into the decimal.Decimal class (!) * */ *************** *** 142,146 **** #endif ! char gmpy_version[] = "1.01"; char _gmpy_cvs[] = "$Id$"; --- 147,151 ---- #endif ! char gmpy_version[] = "1.02"; char _gmpy_cvs[] = "$Id$"; *************** *** 1094,1097 **** --- 1099,1105 ---- * denominator (if none, just numerator!); decimal point NOT allowed. * + * Added in gmpy 1.02: also support a string of the form '12.34', i.e., + * WITH a decimal point and WITHOUT a slash + * * Binary-form: 4-byte numerator length (upper bit set if <0), then * numerator (as above for mpz), then denominator (ditto). *************** *** 1169,1173 **** --- 1177,1193 ---- { char* whereslash = strchr((char*)cp,'/'); + char* wheredot = 0; if(whereslash) *whereslash = 0; + else { + wheredot = strchr((char*)cp, '.'); + if(wheredot) { + PympfObject* temp = str2mpf(stringarg, base, 4*len); + if(temp) { + newob = mpf2mpq((PyObject*)temp); + Py_DECREF((PyObject*)temp); + } + return newob; + } + } if(-1 == mpz_set_str(mpq_numref(newob->q), (char*)cp, base)) { if(whereslash) *whereslash = '/'; *************** *** 2048,2052 **** --- 2068,2082 ---- } else if(PyLong_Check(obj)) { newob = long2mpq(obj); + } else if(PyObject_HasAttrString(obj, "__gmpy_q__")) { + PyObject* result = PyObject_CallMethod(obj, "__gmpy_q__", ""); + if(result) { + if(Pympq_Check(result)) { + newob = (PympqObject *)result; + } else { + Py_DECREF(result); + } + } } + if(options.debug) fprintf(stderr,"any2mpq(%p)->%p\n", obj, newob); *************** *** 2073,2076 **** --- 2103,2115 ---- } else if(PyFloat_Check(obj)) { newob = float2mpz(obj); + } else if(PyObject_HasAttrString(obj, "__gmpy_z__")) { + PyObject* result = PyObject_CallMethod(obj, "__gmpy_z__", ""); + if(result) { + if(Pympz_Check(result)) { + newob = (PympzObject *)result; + } else { + Py_DECREF(result); + } + } } if(options.debug) *************** *** 2102,2106 **** --- 2141,2155 ---- } else if(PyLong_Check(obj)) { newob = long2mpf(obj, bits); + } else if(PyObject_HasAttrString(obj, "__gmpy_f__")) { + PyObject* result = PyObject_CallMethod(obj, "__gmpy_f__", ""); + if(result) { + if(Pympf_Check(result)) { + newob = (PympfObject *)result; + } else { + Py_DECREF(result); + } + } } + if(options.debug) fprintf(stderr, "anynum2mpf(%p,%d)->%p (%d)\n", obj, *************** *** 2145,2150 **** return 1; } else { ! PyErr_SetString(PyExc_TypeError, ! "argument can not be converted to mpq"); return 0; } --- 2194,2201 ---- return 1; } else { ! if(!PyErr_Occurred()) { ! PyErr_SetString(PyExc_TypeError, ! "argument can not be converted to mpq"); ! } return 0; } *************** *** 2899,2904 **** self = (PyObject*)anynum2mpq(self); if(!self) { ! PyErr_SetString(PyExc_TypeError, ! "first argument to qdiv not a number"); return last_try("qdiv", 1, 2, args); } --- 2950,2957 ---- self = (PyObject*)anynum2mpq(self); if(!self) { ! if(!PyErr_Occurred()) { ! PyErr_SetString(PyExc_TypeError, ! "first argument to qdiv not a number"); ! } return last_try("qdiv", 1, 2, args); } *************** *** 2909,2914 **** if(!other) { Py_DECREF(self); ! PyErr_SetString(PyExc_TypeError, ! "second argument to qdiv not a number"); return last_try("qdiv", 1, 2, args); } --- 2962,2969 ---- if(!other) { Py_DECREF(self); ! if(!PyErr_Occurred()) { ! PyErr_SetString(PyExc_TypeError, ! "second argument to qdiv not a number"); ! } return last_try("qdiv", 1, 2, args); } *************** *** 3189,3194 **** newob = anynum2mpq(obj); if(!newob) { ! PyErr_SetString(PyExc_TypeError, ! "gmpy.mpq() expects numeric or string argument"); return NULL; } --- 3244,3251 ---- newob = anynum2mpq(obj); if(!newob) { ! if(!PyErr_Occurred()) { ! PyErr_SetString(PyExc_TypeError, ! "gmpy.mpq() expects numeric or string argument"); ! } return NULL; } *************** *** 3546,3550 **** result = (PyObject*) anynum2mpz(result); if (result) ! result = (PyObject*) anynum2mpq(result); } return result; --- 3603,3607 ---- result = (PyObject*) anynum2mpz(result); if (result) ! result = (PyObject*) anynum2mpq(result); } return result; *************** *** 3564,3568 **** result = (PyObject*) anynum2mpz(result); if (result) ! result = (PyObject*) anynum2mpf(result, 0); } return result; --- 3621,3625 ---- result = (PyObject*) anynum2mpz(result); if (result) ! result = (PyObject*) anynum2mpf(result, 0); } return result; *************** *** 4184,4188 **** return 0; } else { ! PyErr_SetString(PyExc_TypeError, "coercion to gmpy.mpq type failed"); return -1; } --- 4241,4248 ---- return 0; } else { ! if(!PyErr_Occurred()) { ! PyErr_SetString(PyExc_TypeError, ! "coercion to gmpy.mpq type failed"); ! } return -1; } *************** *** 4540,4544 **** /* Check for convergence */ if (!(mpf_cmp_si(r_i2, 0) && ! mpf_get_prec(r_i2) >= (unsigned)precision)) { mpf_mul(pi->f, pi->f, r_i4); mpf_div(pi->f, pi->f, r_i3); --- 4600,4604 ---- /* Check for convergence */ if (!(mpf_cmp_si(r_i2, 0) && ! mpf_get_prec(r_i2) >= (unsigned)precision)) { mpf_mul(pi->f, pi->f, r_i4); mpf_div(pi->f, pi->f, r_i3); *************** *** 5785,5789 **** static char _gmpy_docs[] = "\ ! gmpy 1.01 - General Multiprecision arithmetic for PYthon:\n\ exposes functionality from the GMP 4 library to Python 2.{2,3,4}.\n\ \n\ --- 5845,5849 ---- static char _gmpy_docs[] = "\ ! gmpy 1.02 - General Multiprecision arithmetic for PYthon:\n\ exposes functionality from the GMP 4 library to Python 2.{2,3,4}.\n\ \n\ *************** *** 5824,5826 **** --- 5884,5912 ---- if (options.debug) fprintf(stderr, "gmpy_module at %p\n", gmpy_module); + + /* Experimental: adapt module decimal to our needs */ + char* tweak_decimal = + "def __gmpy_z__(self, f=gmpy.mpz): return f(int(self))\n" + "def __gmpy_q__(self, f=gmpy.mpq): return f(str(self))\n" + "def __gmpy_f__(self, f=gmpy.mpf): return f(str(self))\n" + "try:\n" + " decimal.Decimal.__gmpy_z__ = __gmpy_z__\n" + " decimal.Decimal.__gmpy_q__ = __gmpy_q__\n" + " decimal.Decimal.__gmpy_f__ = __gmpy_f__\n" + "except: pass\n" + ; + PyObject* decimal_module = PyImport_ImportModule("decimal"); + if(decimal_module) { + PyObject* namespace = PyDict_New(); + PyDict_SetItemString(namespace, "decimal", decimal_module); + PyDict_SetItemString(namespace, "gmpy", gmpy_module); + PyDict_SetItemString(namespace, "int", (PyObject*)&PyInt_Type); + PyDict_SetItemString(namespace, "str", (PyObject*)&PyString_Type); + PyObject* result = PyRun_String(tweak_decimal, Py_file_input, + namespace, namespace); + Py_DECREF(namespace); + Py_XDECREF(result); + } else { + PyErr_Clear(); + } } |
From: Alex M. <al...@us...> - 2006-02-26 07:08:22
|
Update of /cvsroot/gmpy/gmpy/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12984/test Modified Files: gmpy_test.py gmpy_test_cvr.py gmpy_test_mpf.py gmpy_test_mpq.py gmpy_test_mpz.py gmpy_test_rnd.py Log Message: Added experimental support for decimal.Decimal, etc - version now 1.02 (rc) Index: gmpy_test.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gmpy_test.py 13 Nov 2005 01:27:13 -0000 1.6 --- gmpy_test.py 26 Feb 2006 07:08:18 -0000 1.7 *************** *** 1,39 **** ! r''' ! >>> gmpy.version() ! '1.0' ! >>> ! ''' ! ! import sys ! import doctest ! import gmpy ! ! if sys.argv[-1] == 'debug': ! gmpy.set_debug(1) ! ! import gmpy_test_cvr ! import gmpy_test_rnd ! import gmpy_test_mpf ! import gmpy_test_mpq ! import gmpy_test_mpz ! ! ! test_modules = (gmpy_test_cvr, gmpy_test_rnd, gmpy_test_mpf, ! gmpy_test_mpq, gmpy_test_mpz, ! ) ! ! _g = gmpy ! print "Unit tests for gmpy 1.01 release candidate" ! print " on Python", sys.version ! print "Testing gmpy %s (GMP %s), default caching (%s, %s, %s..%s)" % ( ! (_g.version(), _g.gmp_version(), _g.get_zcache(), _g.get_qcache(), ! ) + _g.get_zconst()) ! ! pf, pt = 0, 0 ! for x in test_modules: ! print x.__name__, ! failures, tests = x._test() ! print "%3d tests, %d failures" % (tests-pt, failures-pf) ! pf, pt = failures, tests ! ! doctest.master.summarize(1) --- 1,41 ---- ! r''' ! >>> gmpy.version() ! '1.02' ! >>> ! ''' ! ! import sys ! import doctest ! import gmpy ! ! if sys.argv[-1] == 'debug': ! gmpy.set_debug(1) ! ! import gmpy_test_cvr ! import gmpy_test_rnd ! import gmpy_test_mpf ! import gmpy_test_mpq ! import gmpy_test_mpz ! import gmpy_test_dec ! ! ! test_modules = (gmpy_test_cvr, gmpy_test_rnd, gmpy_test_mpf, ! gmpy_test_mpq, gmpy_test_mpz, ! gmpy_test_dec, ! ) ! ! _g = gmpy ! print "Unit tests for gmpy 1.02 release candidate" ! print " on Python", sys.version ! print "Testing gmpy %s (GMP %s), default caching (%s, %s, %s..%s)" % ( ! (_g.version(), _g.gmp_version(), _g.get_zcache(), _g.get_qcache(), ! ) + _g.get_zconst()) ! ! pf, pt = 0, 0 ! for x in test_modules: ! print x.__name__, ! failures, tests = x._test() ! print "%3d tests, %d failures" % (tests-pt, failures-pf) ! pf, pt = failures, tests ! ! doctest.master.summarize(1) Index: gmpy_test_cvr.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_cvr.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gmpy_test_cvr.py 7 Nov 2005 19:21:16 -0000 1.5 --- gmpy_test_cvr.py 26 Feb 2006 07:08:19 -0000 1.6 *************** *** 1,10 **** ! # partial unit test for gmpy 1.01 extra cover # relies on Tim Peters' "doctest.py" test-driver ! # test-version 1.01 r''' >>> print int(_g.gmp_version() in ('4.1.4', '4.1.2', '4.0.1', '3.1.1')) 1 >>> _g.version() ! '1.01' ''' --- 1,10 ---- ! # partial unit test for gmpy 1.02 extra cover # relies on Tim Peters' "doctest.py" test-driver ! # test-version 1.02 r''' >>> print int(_g.gmp_version() in ('4.1.4', '4.1.2', '4.0.1', '3.1.1')) 1 >>> _g.version() ! '1.02' ''' *************** *** 463,467 **** def _test(chat=None): if chat: ! print "Unit tests for gmpy 1.01 release candidate (extra cover)" print " running on Python",sys.version print --- 463,467 ---- def _test(chat=None): if chat: ! print "Unit tests for gmpy 1.02 release candidate (extra cover)" print " running on Python",sys.version print Index: gmpy_test_mpf.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_mpf.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gmpy_test_mpf.py 11 Nov 2005 21:52:23 -0000 1.6 --- gmpy_test_mpf.py 26 Feb 2006 07:08:19 -0000 1.7 *************** *** 1,5 **** ! # partial unit test for gmpy 1.01 mpf functionality # relies on Tim Peters' "doctest.py" test-driver ! # test-version 1.0 r''' >>> dir(a) --- 1,5 ---- ! # partial unit test for gmpy 1.02 mpf functionality # relies on Tim Peters' "doctest.py" test-driver ! # test-version 1.02 r''' >>> dir(a) *************** *** 352,356 **** def _test(chat=None): if chat: ! print "Unit tests for gmpy 1.01 release candidate (mpf functionality)" print " running on Python",sys.version print --- 352,356 ---- def _test(chat=None): if chat: ! print "Unit tests for gmpy 1.02 release candidate (mpf functionality)" print " running on Python",sys.version print Index: gmpy_test_mpq.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_mpq.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gmpy_test_mpq.py 11 Nov 2005 21:52:23 -0000 1.6 --- gmpy_test_mpq.py 26 Feb 2006 07:08:19 -0000 1.7 *************** *** 1,5 **** ! # partial unit test for gmpy 1.01 mpq functionality # relies on Tim Peters' "doctest.py" test-driver ! # test-version 1.0 r''' >>> dir(a) --- 1,5 ---- ! # partial unit test for gmpy 1.02 mpq functionality # relies on Tim Peters' "doctest.py" test-driver ! # test-version 1.02 r''' >>> dir(a) *************** *** 182,185 **** --- 182,187 ---- >>> a gmpy.mpq(41,152) + >>> _g.mpq('12.34') + gmpy.mpq(617,50) >>> _g.set_tagoff(1) 0 *************** *** 225,229 **** >>> _g.mpq('7788') mpq(7788) ! >>> ''' --- 227,232 ---- >>> _g.mpq('7788') mpq(7788) ! >>> _g.mpq('12.34') ! mpq(617,50) ''' *************** *** 315,319 **** def _test(chat=None): if chat: ! print "Unit tests for gmpy 1.01 release candidate (mpq functionality)" print " running on Python",sys.version print --- 318,322 ---- def _test(chat=None): if chat: ! print "Unit tests for gmpy 1.02 release candidate (mpq functionality)" print " running on Python",sys.version print Index: gmpy_test_mpz.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_mpz.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gmpy_test_mpz.py 11 Nov 2005 21:52:23 -0000 1.10 --- gmpy_test_mpz.py 26 Feb 2006 07:08:19 -0000 1.11 *************** *** 1,5 **** ! # partial unit test for gmpy 1.01 mpz functionality # relies on Tim Peters' "doctest.py" test-driver ! # test-version 1.0 r''' >>> filter(lambda x: not x.startswith('_'), dir(_g)) --- 1,5 ---- ! # partial unit test for gmpy 1.02 mpz functionality # relies on Tim Peters' "doctest.py" test-driver ! # test-version 1.02 r''' >>> filter(lambda x: not x.startswith('_'), dir(_g)) *************** *** 574,578 **** def _test(chat=None): if chat: ! print "Unit tests for gmpy 1.01 release candidate (mpz functionality)" print " running on Python",sys.version print --- 574,578 ---- def _test(chat=None): if chat: ! print "Unit tests for gmpy 1.02 release candidate (mpz functionality)" print " running on Python",sys.version print Index: gmpy_test_rnd.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test_rnd.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gmpy_test_rnd.py 11 Nov 2005 21:52:23 -0000 1.5 --- gmpy_test_rnd.py 26 Feb 2006 07:08:19 -0000 1.6 *************** *** 1,5 **** ! # partial unit test for gmpy 1.01 rand functionality # relies on Tim Peters' "doctest.py" test-driver ! # test-version 1.0 r''' >>> r --- 1,5 ---- ! # partial unit test for gmpy 1.02 rand functionality # relies on Tim Peters' "doctest.py" test-driver ! # test-version 1.02 r''' >>> r *************** *** 126,130 **** def _test(chat=None): if chat: ! print "Unit tests for gmpy 1.01 release candidate (rand functionality)" print " running on Python", sys.version print --- 126,130 ---- def _test(chat=None): if chat: ! print "Unit tests for gmpy 1.02 release candidate (rand functionality)" print " running on Python", sys.version print |
From: Alex M. <al...@us...> - 2006-02-26 06:44:22
|
Update of /cvsroot/gmpy/gmpy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3476/src Modified Files: gmpy.c Log Message: Remove occasional warning on comparisons of mpq (and mpf too). Index: gmpy.c =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** gmpy.c 11 Nov 2005 21:52:23 -0000 1.17 --- gmpy.c 26 Feb 2006 06:44:19 -0000 1.18 *************** *** 116,119 **** --- 116,122 ---- * NOT tested on GMP 3 (have none left around...), ONLY on GMP 4.* * + * 1.02: + * fix warning in comparison of mpq's + * */ #include "pymemcompat.h" *************** *** 3970,3977 **** /* COMPARING */ ! static int ! Pympz_cmp(PympzObject *a, PympzObject *b) { - int result = mpz_cmp(a->z, b->z); if(result) { if(result>0) { --- 3973,3978 ---- /* COMPARING */ ! static int _normi(int result) { if(result) { if(result>0) { *************** *** 3985,3996 **** } static int Pympq_cmp(PympqObject *a, PympqObject *b) { ! return mpq_cmp(a->q, b->q); } static int Pympf_cmp(PympfObject *a, PympfObject *b) { ! return mpf_cmp(a->f, b->f); } --- 3986,4002 ---- } static int + Pympz_cmp(PympzObject *a, PympzObject *b) + { + return _normi(mpz_cmp(a->z, b->z)); + } + static int Pympq_cmp(PympqObject *a, PympqObject *b) { ! return _normi(mpq_cmp(a->q, b->q)); } static int Pympf_cmp(PympfObject *a, PympfObject *b) { ! return _normi(mpf_cmp(a->f, b->f)); } |
From: Alex M. <al...@us...> - 2005-11-13 01:27:22
|
Update of /cvsroot/gmpy/gmpy/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3420/test Modified Files: gmpy_test.py Log Message: Removed test warning about known scan0/scan1 bugs on Windows (apparently not around any more, yay); edited docs for version 1.01. Index: gmpy_test.py =================================================================== RCS file: /cvsroot/gmpy/gmpy/test/gmpy_test.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gmpy_test.py 7 Nov 2005 21:04:31 -0000 1.5 --- gmpy_test.py 13 Nov 2005 01:27:13 -0000 1.6 *************** *** 38,42 **** doctest.master.summarize(1) - if sys.platform == 'win32': - print 'NOTE: known bugs with scan0 and scan1 on Windows' - print 'they are being investigated, no need to report, thanks' --- 38,39 ---- |
From: Alex M. <al...@us...> - 2005-11-13 01:27:21
|
Update of /cvsroot/gmpy/gmpy/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3420/doc Modified Files: gmpydoc.txt Log Message: Removed test warning about known scan0/scan1 bugs on Windows (apparently not around any more, yay); edited docs for version 1.01. Index: gmpydoc.txt =================================================================== RCS file: /cvsroot/gmpy/gmpy/doc/gmpydoc.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gmpydoc.txt 12 Nov 2005 00:04:45 -0000 1.5 --- gmpydoc.txt 13 Nov 2005 01:27:12 -0000 1.6 *************** *** 5,58 **** *Notes on history of file gmpydoc.txt* ! Notes for version 0.1 (pre-alpha), first one placed on ! sourceforge -- A. Martelli, al...@ya..., 00/11/06. ! Edited for version 0.2 (still pre-alpha), bugfixes & ! minor performance tweaks, 00/11/15 -- many thanks to ! Pearu Peterson for his contributions re 0.1 -> 0.2! ! Edited for version 0.3 (ditto) -- cleanup, exposing [...1447 lines suppressed...] ! Basically, this works around Python's (excellent!) choice to adopt ! the terminating-model rather than the restartable one for ! exception handling, in a few cases of specific interest to numeric ! computation that's being used in a symbolic setting. ! Most callbacks are module-global, with one specific exception. ! When any gmpy function or method is trying to convert arguments to ! gmpy objects (mpz, mpq, mpf), and a conversion fails, all argument ! objects are examined, looking for a method called '__gmpy__' in ! any of them. ! If one is found, then, rather than raising an error to indicate ! the conversion failure, that method is called as a 'localized ! callback' as above. This lets other, non-gmpy objects participate ! in gmpy computations (if they're willing to handle all cases ! involving them!): Python does much of this via __coerce__ etc, and ! this localized-callback facility does the rest for named ! module-functions and methods, where normal coercion would not ! apply. |
From: Alex M. <al...@us...> - 2005-11-12 00:04:55
|
Update of /cvsroot/gmpy/gmpy/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19507/doc Modified Files: gmpydoc.txt index.html Log Message: Part-edited docs (TODO: finish editing gmpydoc.txt) Index: gmpydoc.txt =================================================================== RCS file: /cvsroot/gmpy/gmpy/doc/gmpydoc.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gmpydoc.txt 8 Aug 2003 09:15:57 -0000 1.4 --- gmpydoc.txt 12 Nov 2005 00:04:45 -0000 1.5 *************** *** 1,4 **** ! gmpy module -- a complete Python 2 interface for GMP 3.1 ! (including a Win32/MSVC++ build). --- 1,4 ---- ! gmpy module -- a complete Python 2.{2,3,4} interface for GMP 4 ! (including Win32/MSVC++ binary builds). *************** *** 38,41 **** --- 38,43 ---- Minor editing for version 1.0 (2003/08/08). + Minor editing for version 1.01 (2005/11/12). + *Acknowledgments* *************** *** 45,49 **** removed feature: conditional possibility to substitute this implementation in place of Python's built-in longs; ! Lots and lots of added features). Special thanks are due to Pearu Peterson for his MANY --- 47,51 ---- removed feature: conditional possibility to substitute this implementation in place of Python's built-in longs; ! lots and lots of added features). Special thanks are due to Pearu Peterson for his MANY *************** *** 57,98 **** *Installation and testing* ! Pre-requisites: Python 2.3, GMP 4.0.1 (see later for Win32). ! GMP 3.1.1 is still supported for the moment (but will ! be phased out soon) -- testing and bugfixes only for ! bugs reproducible in GMP 4 (no more workarounds for ! GMP 3 - only bugs). Not yet any GMP 4 only functionality. ! No known use of Python 2.3-only functionality yet, but ! no support/bugfixes planned for older Python releases. To build gmpy from sources, unpack the sources zipfile ! (gmpy-sources-10.zip, for example, for release 1.0) ! into a new, dedicated directory; cd to that directory ! (from any shell on Unix/Linux, from a 'Dos box' aka ! 'command box' on Windows, etc), and run the command: python setup.py install ! the DistUtils that come with Python 2 take over and ! build and install the gmpy module for you. ! ! On Unix, GMP 4.0.1 must have been previously and separately ! installed; on Win32, the gmp.lib and gmp.h supplied (in the ! gmpy-win32 package, only; file gmpy-win32-library-06.zip, ! please unzip it in the same directory as the sources) can ! be used (the linker will give two warnings, but they are ! innocuous ones -- please ignore them). GMP 3.1.1 for MSVC++ ! 6 is found at: ftp://ftp.whiterose.net/pub/lundman -- but ! you don't need to download that to build and use gmpy. ! GMP 4 for Windows has not been checked out yet. Take care ! when installing GMP 4 that an older GMP 3 doesn't keep ! being used, e.g. on Linux if you have a system-installed ! GMP 3 in /usr/lib and install the newer GMP 4 by default ! (it goes into /usr/local/lib, and depending on various ! details of your system configuration the /usr/lib version ! may keep being used instead). Distutils are not yet supported for the pre-built gmpy.pyd ! for windows, that comes in the gmpy-win32-binary-10.zip file -- just move the gmpy.pyd it contains to c:\Python23 (or wherever you have your Python 2.3 installation). The sources zipfile also contains this file (gmpydoc.txt), --- 59,92 ---- *Installation and testing* ! Pre-requisites: Python 2.2 or better, and GMP 4.0.1 or better (see ! later for Win32). GMP 3.* is not being tested any more. Not yet ! any GMP 4 only functionality. No support nor bugfixes planned for ! older releases of either Python or GMP. To build gmpy from sources, unpack the sources zipfile ! (gmpy-sources-101.zip, for example, for release 1.01) into a new, ! dedicated directory; cd to that directory (from any shell on ! Unix/Linux, from a 'Dos box' aka 'command box' on Windows, from ! Terminal on Mac OS X, etc), and run the command: python setup.py install ! the DistUtils that come with Python take over and build and ! install the gmpy module for you (you may need to use 'sudo' or ! 'su' appropriately to actually perform the isntallation, depending ! on the permissions you're using on Python's site-packages). ! On Unix, GMP 4.0.1 or better must have been previously and ! separately installed; for Win32, see ! http://www.cs.nyu.edu/exact/core/gmp/ . Take care when installing ! GMP 4 that an older GMP 3 doesn't keep being used instead, e.g. on ! Linux if you have a system-installed GMP 3 in /usr/lib and install ! the newer GMP 4 using GMP's default settings (it then goes into ! /usr/local/lib, and depending on various details of your system ! configuration the /usr/lib version may keep being used instead). Distutils are not yet supported for the pre-built gmpy.pyd ! for windows, that comes in the gmpy-win32-binary-101.zip file -- just move the gmpy.pyd it contains to c:\Python23 (or wherever you have your Python 2.3 installation). + [[TODO: clarify binary issue and release ones here!!!]] The sources zipfile also contains this file (gmpydoc.txt), *************** *** 110,133 **** where you unpacked the sources, run at the command prompt: python gmpy_test.py Expected output is something like (details may differ!): """ ! Unit tests for gmpy 1,0 alpha ! on Python 2.3+ (#1, Aug 5 2003, 17:15:06) ! [GCC 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)] ! Testing gmpy 1.0 (GMP 4.0.1), default caching (20, 20, -2..11) gmpy_test_cvr 262 tests, 0 failures gmpy_test_rnd 26 tests, 0 failures ! gmpy_test_mpf 140 tests, 0 failures ! gmpy_test_mpq 242 tests, 0 failures ! gmpy_test_mpz 310 tests, 0 failures ! 5 items had no tests: gmpy_test_cvr._test [[ snip snip ]] ! 25 items passed all tests: [[ snip snip ]] ! 980 tests in 30 items. ! 980 passed and 0 failed. Test passed. """ --- 104,133 ---- where you unpacked the sources, run at the command prompt: + ct test + + and then, at the next prompt: + python gmpy_test.py + Expected output is something like (details may differ!): + """ ! Unit tests for gmpy 1.01 release candidate ! on Python 2.4.1 (#1, Apr 21 2005, 11:14:17) ! [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] ! Testing gmpy 1.01 (GMP 4.1.2), default caching (20, 20, -2..11) gmpy_test_cvr 262 tests, 0 failures gmpy_test_rnd 26 tests, 0 failures ! gmpy_test_mpf 154 tests, 0 failures ! gmpy_test_mpq 260 tests, 0 failures ! gmpy_test_mpz 370 tests, 0 failures ! 6 items had no tests: gmpy_test_cvr._test [[ snip snip ]] ! 28 items passed all tests: [[ snip snip ]] ! 1072 tests in 34 items. ! 1072 passed and 0 failed. Test passed. """ *************** *** 142,156 **** *PLEASE* report any failures to gmpy's maintainers, with ! any details you can supply on your machine, on your OS, and ! on your installation of GMP 4, gmpy 1.0, Python 2.3, and any ! other relevant issue (your C/C++ compiler & libraries, &c). ! *THANKS* in advance -- bug reporting and feedback is your key contribution to the gmpy project! (Reports of any _successful_ installations will also be welcome, if it's accompanied by enough details -- again, THANKS in advance!). *General notes on gmpy* gmpy exposes to Python three types of numbers that are implemented in both GMP 3 and GMP 4: --- 142,161 ---- *PLEASE* report any failures to gmpy's maintainers, with ! all details you can supply on your machine, on your OS, and ! on your installation of GMP 4, gmpy 1.01, Python 2.3 or 2.4, ! and any other relevant issue (your C/C++ compiler & libraries, ! &c). *THANKS* in advance -- bug reporting and feedback is your key contribution to the gmpy project! (Reports of any _successful_ installations will also be welcome, if it's accompanied by enough details -- again, THANKS in advance!). + The best way to report bugs (including unit-test failures) is via + https://sourceforge.net/tracker/?group_id=13335&atid=113335 , the + Sourceforce bug tracker. *General notes on gmpy* + TODO: update from here + gmpy exposes to Python three types of numbers that are implemented in both GMP 3 and GMP 4: Index: index.html =================================================================== RCS file: /cvsroot/gmpy/gmpy/doc/index.html,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** index.html 8 Aug 2003 09:48:57 -0000 1.5 --- index.html 12 Nov 2005 00:04:45 -0000 1.6 *************** *** 14,19 **** <BODY> <FONT SIZE=-1> ! Last updated on: 2003, Aug 8; ! for GMPY release: 1.0 alpha <A href="http://sourceforge.net"> <IMG src="http://sourceforge.net/sflogo.php?group_id=13335&type=1" --- 14,19 ---- <BODY> <FONT SIZE=-1> ! Last updated on: 2005, Nov 12; ! for GMPY release: 1.01 beta <A href="http://sourceforge.net"> <IMG src="http://sourceforge.net/sflogo.php?group_id=13335&type=1" *************** *** 47,52 **** The first GMPY goal is to develop this module into a complete exposure of MPZ, MPF (floating-point), and MPQ (rational) ! functionality of current GMP (release 4.0), that will fully ! support current Python (release 2.3) and its handy 'distutils' (and also support a "C API" allowing some level of interoperation with other C-written extension modules for Python). --- 47,52 ---- The first GMPY goal is to develop this module into a complete exposure of MPZ, MPF (floating-point), and MPQ (rational) ! functionality of current GMP (release 4), that will fully ! support current Python releases (2.2, 2.3, 2.4) and the 'distutils' (and also support a "C API" allowing some level of interoperation with other C-written extension modules for Python). *************** *** 90,95 **** <H1>Project Status and near-future plans</H1> ! The gmpy module's alpha release (latest current release ! as of 2002/08/08: 1.0) is available for download in both source and Windows-binary form. It exposes all of the mpz, mpq and mpf functionality that was already available in GMP 3.1, and --- 90,95 ---- <H1>Project Status and near-future plans</H1> ! The gmpy module's beta release (latest current release ! as of 2005/11/12: 1.01) is available for download in both source and Windows-binary form. It exposes all of the mpz, mpq and mpf functionality that was already available in GMP 3.1, and *************** *** 112,132 **** <p> We started the GMPY project using a VC++ port of GMP.LIB "just found on ! the net", but have currently switched to the port by Jorgen Lundman ! found at <a href="ftp://ftp.whiterose.net/pub/lundman/"> ! ftp://ftp.whiterose.net/pub/lundman/</a> (bravo Lundy!). Windows ! users do not need to download from Jorgen's site: a separate 'binary ! library' package, including Lundy's ports of GMP.LIB and GMP.H, is made ! available on the gmpy project's ftp-space for Windows/VC++6 users that ! do want to re-build the gmpy module from sources; and also, another ! separate 'binary module' package is supplied, containing only the ! pre-built GMPY.PYD, for those who do <b>not</b> want to re-build from ! sources. For GMP 4.0, the plan is to use the native support it offers ! for the Windows platform, but this has not yet been explored in ! detail. <p> <b>Do</b> note, however, that <b>all</b> gmpy users should download the gmpy source-package as well, as currently that is the one including <b>gmpy</b> documentation and unit-tests! - <H2>Currently-open issues</h2> <p> --- 112,128 ---- <p> We started the GMPY project using a VC++ port of GMP.LIB "just found on ! the net", and later a port by Jorgen Lundman, but are currently relying ! on other volunteers to build Windows binaries since we don't have any ! Windows machine any more. <a ! href="http://www.cs.nyu.edu/exact/core/gmp/">This site</a> does appear ! to offer all needed files and instructions for Windows developers who ! want to re-build the gmpy module from sources; the gmpy project itself ! just supplies a separate 'binary module' package is supplied, containing ! only the pre-built GMPY.PYD, for those who do <b>not</b> want to ! re-build from sources. <p> <b>Do</b> note, however, that <b>all</b> gmpy users should download the gmpy source-package as well, as currently that is the one including <b>gmpy</b> documentation and unit-tests! <H2>Currently-open issues</h2> <p> *************** *** 151,156 **** Unit tests are not considered a weak point any more; the over 1000 unit-tests now being run provide a decent cover of 93+% SLOC for gmpy.c, ! up from 72% in 0.7. The non-covered SLOCs (about 170 of gmpy.c's ! current 2600) are mostly disaster-tests to handle out-of-memory situations, code providing optional debugging output (for debugging the gmpy module -- see the set_debug facility), a smattering of 'defensive --- 147,152 ---- Unit tests are not considered a weak point any more; the over 1000 unit-tests now being run provide a decent cover of 93+% SLOC for gmpy.c, ! up from 72% in 0.7. The non-covered SLOCs (about 370 of gmpy.c's ! current 5820) are mostly disaster-tests to handle out-of-memory situations, code providing optional debugging output (for debugging the gmpy module -- see the set_debug facility), a smattering of 'defensive *************** *** 159,168 **** (mostly provided for the specific use of PySymbolic, and intended to be tested by that package). We'll have to do better, eventually, but, for ! now, this can be considered OK for an alpha-release. <p> In the attempt to make gmpy as useful as can be for both stand-alone use, and also in the context of PySymbolic, a tad too many design decisions have been delayed/postponed by introducing module-level ! flags, letting us 'have it both ways' in the current alpha gmpy; this has produced a somewhat unwieldy mix of module-level flag-setting and call-back functions. This whole area's architecture --- 155,164 ---- (mostly provided for the specific use of PySymbolic, and intended to be tested by that package). We'll have to do better, eventually, but, for ! now, this can be considered OK for a beta-release. <p> In the attempt to make gmpy as useful as can be for both stand-alone use, and also in the context of PySymbolic, a tad too many design decisions have been delayed/postponed by introducing module-level ! flags, letting us 'have it both ways' in the current beta gmpy; this has produced a somewhat unwieldy mix of module-level flag-setting and call-back functions. This whole area's architecture *************** *** 176,183 **** proven unnecessary. All relevant GMP 4 functionality will be exposed. <p> ! No predictions on timing, though. gmpy 1.0 meets all current needs of the main author, so his motivation to work more on it is low:-). So, don't hold your breath (pitching in and helping it happen, on the ! other hand, _might_ be advisable:-). <p> <A HREF="http://sourceforge.net/projects/gmpy/">Project --- 172,179 ---- proven unnecessary. All relevant GMP 4 functionality will be exposed. <p> ! No predictions on timing, though. gmpy 1.01 meets all current needs of the main author, so his motivation to work more on it is low:-). So, don't hold your breath (pitching in and helping it happen, on the ! other hand, _might_ be advisable, and will surely yield results:-). <p> <A HREF="http://sourceforge.net/projects/gmpy/">Project |
From: Alex M. <al...@us...> - 2005-11-11 21:52:34
|
Update of /cvsroot/gmpy/gmpy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21462/src Modified Files: gmpy.c Log Message: Minor cleanups in preparation for 1.01 release. Index: gmpy.c =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** gmpy.c 7 Nov 2005 21:55:39 -0000 1.16 --- gmpy.c 11 Nov 2005 21:52:23 -0000 1.17 *************** *** 5,9 **** * Rewritten by Niels Möller, May 1996 * ! * Version for GMP-4, Python-2, with support for MSVC++6. * addition of mpf's, &c: Alex Martelli (al...@ya..., Nov 2000). * cleanups & reorgs leading to 1.0: Alex Martelli (until Aug 2003) --- 5,9 ---- * Rewritten by Niels Möller, May 1996 * ! * Version for GMP-4, Python-2.{2,3,4}, with support for MSVC++6, * addition of mpf's, &c: Alex Martelli (al...@ya..., Nov 2000). * cleanups & reorgs leading to 1.0: Alex Martelli (until Aug 2003) *************** *** 114,119 **** * fixed bug on mpq('123') [[str2mpq on string w/o a slash]] * added floordiv and truediv operators, and tests for them ! * ! * TODO: look deeper into divm (when operands are not mutually prime) * */ --- 114,118 ---- * fixed bug on mpq('123') [[str2mpq on string w/o a slash]] * added floordiv and truediv operators, and tests for them ! * NOT tested on GMP 3 (have none left around...), ONLY on GMP 4.* * */ *************** *** 171,175 **** 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. */ --- 170,174 ---- 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 the result directly. By request of Pearu Peterson, to ease use of gmpy in symbolic computations. */ *************** *** 5780,5785 **** static char _gmpy_docs[] = "\ ! gmpy 0.9 - General Multiprecision arithmetic for PYthon:\n\ ! exposes functionality from the GMP 3.1.1 library to Python 2.\n\ \n\ Allows creation of multiprecision integer (mpz), float (mpf),\n\ --- 5779,5784 ---- static char _gmpy_docs[] = "\ ! gmpy 1.01 - General Multiprecision arithmetic for PYthon:\n\ ! exposes functionality from the GMP 4 library to Python 2.{2,3,4}.\n\ \n\ Allows creation of multiprecision integer (mpz), float (mpf),\n\ |