Re: extend methods of decimal module

2014-02-28 Thread casevh
writing it in C I would suppose). IIRC, cdecimal uses a Number Theory Transform for multiplication of very large numbers. It has been a while since I looked so I could be wrong. casevh -- https://mail.python.org/mailman/listinfo/python-list

Re: extend methods of decimal module

2014-02-19 Thread casevh
code.google.com/p/gmpy/ ) module? It supports all the transcendental function available in the MPFR library. I did a quick performance test of sqrt() and ln() at around 1000 decimal digits. gmpy2 was about ~200 times faster than the corresponding functions in decimal. casevh -- https://mail.python.org/mailman/listinfo/python-list

Re: New to Py 3.3.3 having prob. with large integer div. float.

2014-02-10 Thread casevh
k. > > TIA > Dan The following example will divide two integers with a result precision of 1024 bits: import gmpy2 # Set mpfr precision to 1024 gmpy2.get_context().precision=1024 # Omitting code a = gmpy2.mpz(SML)/gmpy2.mpz(x) Python 3.x performs true division by default. When integer division involves an mpz, the result will be an mpfr with the precision of the current context. Does this help? casevh -- https://mail.python.org/mailman/listinfo/python-list

Re: Calculate Big Number

2013-01-08 Thread casevh
n include optimized assembler for the CPU you're using. But > I guess it needs more memory. Hence disk-swapping could be an issue > on performance. > gmpy will be faster than Python as the numbers get larger. The cutover varies depending on the platform, but usually occurs between 50 and 100 digits. casevh > > --gv -- http://mail.python.org/mailman/listinfo/python-list

Re: bit count or bit set && Python3

2012-10-26 Thread casevh
On Thursday, October 25, 2012 7:56:25 AM UTC-7, Charles Hixson wrote: > In Python3 is there any good way to count the number of on bits in an > integer (after an & operation)? You may want to look at gmpy2[1] and the popcount() function. > > Alternatively, is there any VERY light-weight impleme

Re: why did GMPY change the names of its functions?

2012-03-26 Thread casevh
isqrt() returns an "mpz". As part of the documentation for the beta release, I will document the name changes. "import gmpy2 as gmpy; gmpy.scan0=gmpy.bit_scan0; etc" should work just fine. If you encounter problems with the alpha release, please open an issue on gmpy's

Re: PyCrypto builds neither with MSVC nor MinGW

2012-03-12 Thread casevh
ot;python setup.py install" was successful. I created a binary installer with "python setup.py bdist-wininst". There may be a cleaner way to build PyCrypto, but these steps worked for me. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: PyCrypto builds neither with MSVC nor MinGW

2012-02-06 Thread casevh
cluded in gmpy's source download. I would try to build MPIR and gmpy first and then adapt/modify the process for PyCrypto. MPIR home page: www.mpir.org gmpy source: gmpy.googlecode.com/files/gmpy-1.15.zip > doesn't even MinGW install PyCrypto for me? > > Thanks for all sugge

Re: Counting bits in large string / bit vector

2011-09-26 Thread casevh
function or something similar. > There is also another library  http://pypi.python.org/pypi/bitarray > which resembles numpy's bit array. > > Hope it helps, > S.Nizamov You can also use gmpy or gmpy2. >>> a=gmpy2.mpz(123) >>> bin(a) '0b011' &g

Re: Representation of floats (-> Mark Dickinson?)

2011-09-06 Thread casevh
1.1 > 1.2102 > >>> print (1.1 * 1.1) > 1.2102 > >>> print(repr((1.1 * 1.1))) > 1.2102 > > >>> '{:g}'.format(1.1 * 1.1) > '1.21' > I get same results as you do for Python 3.1.4 and 3.2.2. IIRC, Python 3.2 changed (for floats) __str__ to call __repr__. That should explain the difference between 3.1.4 and 3.2.2 Also note that 1.1 * 1.1 is not the same as 1.21. >>> (1.1 * 1.1).as_integer_ratio() (5449355549118301, 4503599627370496) >>> (1.21).as_integer_ratio() (1362338887279575, 1125899906842624) This doesn't explain why 2.7.2 displayed a different result on your computer. What do you get for as_integer_ratio() for (1.1 * 1.1) and (1.21)? casevh > jmf -- http://mail.python.org/mailman/listinfo/python-list

Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1")

2011-08-21 Thread casevh
2, I implemented the nb_inplace_add function and performance (for the gmpy.mpz type) is much better for the in-place addition. For the adventuresome, gmpy2 implements a mutable integer type called xmpz. It isn't much faster until the values are so large that the memory copy times become significant

Re: Puzzled about the output of my demo of a proof of The Euler Series

2011-08-10 Thread casevh
roof only asserts that sum(1/k^2) is between the upper and lower partial sums. The upper and lower partial sums both converge to pi^2/6 from below and since the sum(1/k^2) is between the two partial sums, it must also converge to pi^2/6. Try calculating sum(1/k^2) for k in range(1, 2**n)

Re: Large number multiplication

2011-07-07 Thread casevh
ino Laser GmbH > Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932- Hide > quoted text - > > - Show quoted text - A quick search on the Python issue tracker (bugs.python.org) yields the following issues: http://bugs.python.org/issue560379 http://bugs.python.org/issue4258 The issues also refer to discussion threads on the python-dev mailing list. casevh -- http://mail.python.org/mailman/listinfo/python-list

ANN: GMPY2 or How I learned to love "nan"

2011-06-08 Thread casevh
ise Python exceptions when exceptional events occur with MPFR arithmetic; for example, comparing against "nan" can trigger an exception * more complete coverage for MPFR * many function names were changed to be more consistent Please report any issues! casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: integer multiplication

2011-04-04 Thread casevh
decrease the overhead for gmpy operations. The breakeven point for older versions will be higher so if you are running performance critical code with older versions of gmpy, I'd recommend upgrading to 1.14. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Porting Python2 C-API/Swig based modules to Python 3

2011-02-23 Thread casevh
mbol not found: _PyCObject_FromVoidPtr >   Referenced from: > /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packag­es/_pcapmodule.so >   Expected in: flat namespace >  in > /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packag­es/_pcapmodule.so > > > > >>> ^D- Hide quoted text - > > - Show quoted text - This is a change in the C-API in 3.2. See http://bugs.python.org/issue5630 casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: inverse of a matrix with Fraction entries

2010-11-27 Thread casevh
On Nov 27, 3:08 pm, Steven D'Aprano wrote: > On Fri, 26 Nov 2010 19:21:47 -0800, casevh wrote: > > On Nov 26, 2:11 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > >> On Fri, 26 Nov 2010 12:54:12 -0800, John Nagle wrote: > >> >

Re: inverse of a matrix with Fraction entries

2010-11-27 Thread casevh
On Nov 27, 4:00 am, m...@distorted.org.uk (Mark Wooding) wrote: > casevh writes: > > I coded a quick matrix inversion function and measured running times > > using GMPY2 rational and floating point types. For the floating point > > tests, I used a precision of 1000 bits

Re: inverse of a matrix with Fraction entries

2010-11-26 Thread casevh
e same matrix using rationals would take a month or longer and require much more memory. But the rational solution would be exact. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: inverse of a matrix with Fraction entries

2010-11-26 Thread casevh
ns. GMPY is availabe at http://code.google.com/p/gmpy/ casevh Disclaimer: I'm the current maintainer of GMPY. -- http://mail.python.org/mailman/listinfo/python-list

ANN: GMPY 1.14 and GMPY2 alpha1 released

2010-11-18 Thread casevh
am curious if there are real-world performance improvements. Please report any issues! casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-06 Thread casevh
gt; an amd64 compiler anyway, AFAIK. The original version of the Windows 7 SDK includes the command line version of the VS 2008 amd64 compiler. I've used it compile MPIR and GMPY successfully. The GMPY source includes a text file describing the build process using the SDK tools. casevh > &g

ANN: GMPY 1.12 and GMPY2 unstable released

2010-06-26 Thread casevh
assembly code optimized for the CPU at runtime. The 64-bit Windows installers were compiled Microsoft's SDK compilers using MPIR 2.1.1. Detailed instructions are included if you want to compile your own binary. Please report any issues! casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Where does "make altinstall" put stuff?

2010-05-29 Thread casevh
nted somewhere? > >    I want to make sure that no part of the existing Python installation > on Fedora Core is overwritten by an "altinstall" of 2.6. > >                                 John Nagle It's placed in the directory specified by --prefix. If --prefi

Re: Calculating very large exponents in python

2010-03-09 Thread casevh
On Mar 8, 10:39 pm, casevh wrote: > [also replying to Geremy since the OP's message doesn't appear...] > > On Mar 8, 11:05 am, geremy condra wrote: > > > > > > > On Mon, Mar 8, 2010 at 2:15 AM, Fahad Ahmad wrote: > > > Thanks Geremy, > > &

Re: Calculating very large exponents in python

2010-03-08 Thread casevh
rmat factorization attack. In the example you gave, it returns > nearly immediately. > > Geremy Condra- Hide quoted text - > > - Show quoted text - For a Python-based solution, you might want to look at pyecm (http:// sourceforge.net/projects/pyecm/) On a system with gmpy installed

Re: ANN: GMPY 1.11 released

2010-02-03 Thread casevh
On Feb 3, 10:22 am, Mensanator wrote: > On Feb 3, 10:37 am, casevh wrote: > > > > > On Feb 2, 10:03 pm, Mensanator wrote: > > > > On Feb 2, 12:45 am, casevh wrote: > > > > > Everyone, > > > > > I'm pleased to annouce the final re

Re: ANN: GMPY 1.11 released

2010-02-03 Thread casevh
On Feb 2, 10:03 pm, Mensanator wrote: > On Feb 2, 12:45 am, casevh wrote: > > > > > Everyone, > > > I'm pleased to annouce the final release of GMPY 1.11. > > GMPY is a wrapper for the MPIR or GMP multiple-precision > > arithmetic library. GMPY 1.

ANN: GMPY 1.11 released

2010-02-02 Thread casevh
CPU type and use code optimized for the CPU at runtime. The 64-bit Windows installers were compiled Microsoft's SDK compilers using MPRI 1.3.1. Detailed instructions are included if you want to compile your own binary. Please report any issues! casevh -- http://mail.python.org/mailman/li

Re: Python distutils build problems with MinGW

2010-02-01 Thread casevh
put them in the libs folder. That didn't > work either. > > I've also tried adding some print statements in the \distutils\dist.py > file, in the parse_config_files() function, just to see if Python > properly parses the config file. And it does, both Python 2.6 and 3.1 > parse the distutils.cfg file properly. Yet something is making python > 3 look for the VS/VC compiler instead of MinGW. I'll keep updating on > any progres..- Hide quoted text - > > - Show quoted text - I think this is http://bugs.python.org/issue6377. I applied the patch to my local copy of Python 3.1 and it seems to work. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: ISO module for binomial coefficients, etc.

2010-01-24 Thread casevh
but fast, support for calculating binomial coefficients and factorials. If you are floating point approximations, check out mpmath (http://code.google.com/p/mpmath/). casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Rounding up to the next 100

2010-01-21 Thread casevh
n is using math.ceil and math.floor. >>> import math >>> 100*math.ceil(1234.5678/100) 1300 >>> 100*math.floor(1234.5678/100) 1200 >>> 100*math.ceil(-1234.5678/100) -1200 >>> 100*math.floor(-1234.5678/100) -1300 casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: interactive terminal in Ubuntu Linux : libreadline5-dev works only in Python 2.6 not 3.1

2010-01-12 Thread casevh
On Jan 12, 9:03 pm, Dave WB3DWE wrote: > On Sun, 10 Jan 2010 22:08:20 -0800 (PST), casevh > wrote: > > > > > > >On Jan 10, 8:16 pm, Dave WB3DWE wrote: > >> On Sat, 9 Jan 2010 16:48:52 -0800 (PST), casevh > >> wrote: > > >> >On Jan 9,

Re: interactive terminal in Ubuntu Linux : libreadline5-dev works only in Python 2.6 not 3.1

2010-01-10 Thread casevh
On Jan 10, 8:16 pm, Dave WB3DWE wrote: > On Sat, 9 Jan 2010 16:48:52 -0800 (PST), casevh > wrote: > > >On Jan 9, 3:10 pm, pdlem...@earthlink.net wrote: > >> On Sat, 9 Jan 2010 13:27:07 -0800 (PST), casevh > >> wrote: > > >1) Try the commands again. M

Re: interactive terminal in Ubuntu Linux : libreadline5-dev works only in Python 2.6 not 3.1

2010-01-09 Thread casevh
On Jan 9, 3:10 pm, pdlem...@earthlink.net wrote: > On Sat, 9 Jan 2010 13:27:07 -0800 (PST), casevh > wrote: > >Did you recompile Python 3.1.1 after installing libreadline5-dev? > > >(From the Python 3.1.1 directory. Your options to configure may vary.) > > >make dis

Re: interactive terminal in Ubuntu Linux : libreadline5-dev works only in Python 2.6 not 3.1

2010-01-09 Thread casevh
On Jan 9, 10:06 am, Dave WB3DWE wrote: > On Jan 6 I inquired how to "fix" the 3.1.1 interactive terminal > in Ubuntu Linux.   Left arrow yields ^[[D , etc. > > casevh helped by suggesting "libreadline5-dev" be installed. > Did so with Synaptic Package Manager.

Re: Caching objects in a C extension

2010-01-08 Thread casevh
On Jan 8, 8:56 am, Antoine Pitrou wrote: > Le Fri, 08 Jan 2010 08:39:17 -0800, casevh a écrit : > > > > > Thanks for the reply. I realized that I missed one detail. The objects > > are created by the extension but are deleted by Python. I don't know > > that

Re: Caching objects in a C extension

2010-01-08 Thread casevh
On Jan 8, 9:19 am, "Diez B. Roggisch" wrote: > casevh schrieb: > > > > > > > On Jan 8, 2:59 am, "Diez B. Roggisch" wrote: > >> casevh schrieb: > > >>> I'm working with a C extension that needs to rapidly create and delete

Re: Caching objects in a C extension

2010-01-08 Thread casevh
On Jan 8, 2:59 am, "Diez B. Roggisch" wrote: > casevh schrieb: > > > > > > > I'm working with a C extension that needs to rapidly create and delete > > objects. I came up with an approach to cache objects that are being > > deleted and resurre

Caching objects in a C extension

2010-01-08 Thread casevh
safer to create the new reference before stuffing the object into the cache (even though it will look like there is a memory leak when running under a debug build)? Thanks in advance for any comments, casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Python interactive terminal in Ubuntu Linux : some keys fouled up

2010-01-06 Thread casevh
t >>>   ?                   > > Thanks,             Dave        pdlem...@earthlink.net Assuming you compiled the source code, you will also need to install "libreadline5-dev" via Synaptic or apt-get. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: the need for 64 bits

2009-12-28 Thread casevh
mbs is stored as a signed size_t > type, so on a 64-bit machine memory really is the only limitation. > > -- > Mark Based on comments on the GMP website, the maximum number of bits on a 64-bit platform is limited to 2**37 or 41 billion decimal digits. A number this size requires 16GB of

Re: How do I install GMPY 1.11 on a Mac with OS X 10.6 and Python 3.1?

2009-12-26 Thread casevh
oblem. It appears to be a problem in the build > >> >> script. > > >> >> > Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/ > >> >> > MacOSX10.4u.sdk > > >> >> My guess would

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-12-18 Thread casevh
On Dec 18, 10:28 am, Joachim Dahl wrote: > My mistake seems to be that I declared > > char a, b; > > instead of > > int a, b; > > Thank you for sorting this out. > > Joachim I think you need to initialize them, too. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-12-18 Thread casevh
oo() ('A', 'B') >>> foo(b='b') ('A', 'b') >>> foo() ('A', 'B') >>> foo('a') ('a', 'B') >>> foo('a', b='b') ('a', 'b') >>> foo() ('A', 'B') >>> casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-11-30 Thread casevh
27;) > >>> foo(a='a',b='b') > > but the following fails:>>> foo(b='b') > > RuntimeError: impossible: 'CC' > > Is this error-message expected? Nope. It appears to be a bug in Python. The format code 'C' is missin

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-11-30 Thread casevh
ed to write>>> foo(b'X') > > > instead. From the Python C API, I have not been able to explain this > > new behavior. > > What is the correct way to pass a single character argument to > > Python3.1 > > extension modules?- Hide quoted text - > &

ANN: GMPY 1.11rc1 is available

2009-11-29 Thread casevh
operations. I plan to add a new mutable integer type in the next release of GMPY. If you want to experiment with mutable integers now, GMPY can be compiled with mutable version of the standard 'mpz' type. Please see the file "mutable_mpz.txt" for more information. Please repor

Re: C api and checking for integers

2009-11-12 Thread casevh
; (1) The doc says: Returns 1 if the object o provides numeric protocols, and > false otherwise. This function always succeeds. > > What do they mean: "always succeeds" ? That it will always return true or false; it won't raise an error. > > (2) It seems PyNumber_check(py_

Re: python3.1 shell and Arrow Keys ?

2009-10-08 Thread casevh
debian lenny, and compiled python3.1.1, as far > as I remember, just with sh configure, make, make install ... > > Regards,  Peter > > -- > Peter Billam      www.pjb.com.au   www.pjb.com.au/comp/contact.html You probably need to install the readline-devel package. I don't us

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread casevh
the underlying library for gmpy, provides only the basic floating point operations. gmpy implements a very limited exponentiation function. Python's math library will convert an mpf to a float automatically so I think the revised calculation for nhops should work with either any numerical type that supports __float__. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread casevh
gt;   File "C:\Python31\lib\turtle.py", line 3165, in _goto >     nhops = 1+int((diffsq**0.5)/(3*(1.1**self._speed)*self._speed)) > ValueError: mpq.pow fractional exponent, inexact-root > Warning: Completely untested fix ahead! What happens if you change turtle.py to use nhops=1+int((math.sqrt(diffsq)/(3*math.pow(1.1, self._speed) *self._speed)) casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: pack an integer into a string

2009-07-24 Thread casevh
On Jul 24, 3:28 pm, superpollo wrote: > is there a pythonic and synthetic way (maybe some standard module) to > "pack" an integer (maybe a *VERY* big one) into a string? like this: > >   >>> number = 252509952 >   >>> hex(number) >   '0xf0cff00' >   >>> > > so i would like a string like '\xf0\xcf\

Re: integer square roots

2009-07-23 Thread casevh
e installer and it should automatically detect your existing Python installation. The executable is small. ;-) casevh p.s. If you're using a 64-bit Windows system, let me know and I'll step you through the manual process. -- http://mail.python.org/mailman/listinfo/python-list

Re: integer square roots

2009-07-23 Thread casevh
x box, it can test approximately 400,000 100-digits numbers per second. The time includes conversion from a string. If the numbers are already Python longs, it can check 800,000 per second. Checking a billion is not unreasonable. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: GMPY 1.10 alpha with support for Python 3

2009-07-19 Thread casevh
GMPY 1.10 beta is now available. This version fixes an issue where very large objects would be cached for reuse instead of being freed. Source code and Windows installers may be found at http://code.google.com/p/gmpy/downloads/list casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: GMPY 1.10 alpha with support for Python 3

2009-07-08 Thread casevh
On Jul 8, 5:03 pm, Mensanator wrote: > On Jul 7, 12:47 am, Mensanator wrote: > > > > > On Jul 7, 12:16 am, casevh wrote: > > > > I discovered a serious bug with comparisons and have posted alpha2 > > > which fixes that bug and adds Unicode support for Pyth

Re: ANN: GMPY 1.10 alpha with support for Python 3

2009-07-06 Thread casevh
I discovered a serious bug with comparisons and have posted alpha2 which fixes that bug and adds Unicode support for Python 2.x casevh -- http://mail.python.org/mailman/listinfo/python-list

ANN: GMPY 1.10 alpha with support for Python 3

2009-07-06 Thread casevh
t CPU. Please test with your applications and report any issues found! casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: How to locate the bit in bits string?

2009-04-29 Thread casevh
On Apr 28, 5:39 pm, Li Wang wrote: > 2009/4/29 Tim Chase : > > >> I want to concatenate two bits string together: say we have '1001' and > >> '111' which are represented in integer. I want to concatenate them to > >> '100' (also in integer form), my method is: > >> ('1001' << 3) | 111 > >> whi

Re: Python and GMP.

2009-04-21 Thread casevh
On Apr 21, 5:47 am, Paul Rubin <http://phr...@nospam.invalid> wrote: > casevh writes: > > > Could you test pow(a,b,c) where a,b,c are each 300 decimal digits? > > > $ py25 -m timeit -s  "a=long('23'*150);b=long('47'*150);m=long > > ('

Re: Python and GMP.

2009-04-21 Thread casevh
On Apr 21, 12:11 am, Paul Rubin <http://phr...@nospam.invalid> wrote: > casevh writes: > > Python 3.1 is significantly faster than Python 2.x on 64-bit > > platforms. The following times are for multiplication with 2, 30 and > > 300 decimal digits. > > Could yo

Re: Python and GMP.

2009-04-20 Thread casevh
best of 3: 12.5 usec per loop $ py31 -m timeit -s "a=int('23'*150);b=int('47'*150)" "c=a*b" 10 loops, best of 3: 3.13 usec per loop $ py25 -m timeit -s "import gmpy;a=gmpy.mpz('23'*150);b=gmpy.mpz ('47'*150)" "c=a*b" 100 loops, best of 3: 0.673 usec per loop Platform is 64-bit Linux with Core2 Duo processor. gmpy was linked against MPIR 1.1. MPIR is an LGPLv2 fork of GMP and is significantly faster than GMP 4.2.x. The newly released GMP 4.3.0 is about 10% faster yet. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Number of bits/sizeof int

2009-02-02 Thread casevh
bits necessary to represent its argument in binary:" > > Any tips on how to get this in 2.5.2 as that's the production version > I'm stuck with. > > Cheers, > > Jon. If performance does become an issue, the newly released gmpy 1.04 includes bit_length(). casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: nth root

2009-02-01 Thread casevh
On Feb 1, 10:02 pm, Mensanator wrote: > On Feb 1, 8:20 pm, casevh wrote: > > > > > On Feb 1, 1:04 pm, Mensanator wrote: > > > > On Feb 1, 2:27 am, casevh wrote: > > > > > On Jan 31, 9:36 pm, "Tim Roberts" wrote: > > > > > &

Re: nth root

2009-02-01 Thread casevh
On Feb 1, 1:04 pm, Mensanator wrote: > On Feb 1, 2:27 am, casevh wrote: > > > On Jan 31, 9:36 pm, "Tim Roberts" wrote: > > > > Actually, all I'm interested in is whether the 100 digit numbers have an > > > exact integral root, or not.  At the

Re: nth root

2009-02-01 Thread casevh
> Tim Take a look at gmpy and the is_power function. I think it will do exactly what you want. http://code.google.com/p/gmpy/ casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: gmpy and counting None

2008-10-13 Thread casevh
to gmpy.mpz type failed > > > > Is this a bug in gmpy? > > If yes is there any way to issue the bug athttp://code.google.com/p/gmpy/ > without creating a gmail account? I've added it for you. > > Thanks > > Martin Thanks for reporting the issue. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: numeric emulation and __pos__

2008-07-08 Thread casevh
however it is also used to force an existing number to match a new precision setting. For example, using the decimal module: >>> from decimal import * >>> t=Decimal('1.23456') >>> t Decimal("1.23456") >>> getcontext().prec = 5 >>> +t Decimal("1.2346") > > Thanks for the feedback. > -- > Ethan casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: conflict between multiple installs of python (linux)

2008-07-05 Thread casevh
nother! > > Thankyou. Python's path is build by site.py. In the file /usr/lib/python2.5/ site.py, look for the line "prefixes.insert(0, '/usr/local')" and comment it out. That should do it. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating list of possible configurations

2008-07-03 Thread casevh
of > no value. gmpy is supported on Python 2.6. A new version and Windows binaries were released shortly after 2.6b1 was released. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiprecision arithmetic library question.

2008-06-19 Thread casevh
> No, I do not know that. Define desperate. > Does Python support the extended Euclidean algorithm > and other number theory functions? No. > How fast does Python multiply? Python uses the Karatsuba algorithm which O(n^1.585). Division is still O(n^2). > Not that the latter is particularly impo

Re: Hrounding error

2008-06-18 Thread casevh
gt; text - > It's not a Python problem. That is just the behavior for floating- point arithmetic. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Hrounding error

2008-06-17 Thread casevh
ry floating-point. http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiprecision arithmetic library question.

2008-06-17 Thread casevh
; (I am new to Python) > > -- > Michael Press GMPY provides the interface between Python and GMP. It is available at http://code.google.com/p/gmpy/downloads/list casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: 32 bit or 64 bit?

2008-06-15 Thread casevh
e. It uses Python as it glue/scripting language. It includes support for MPFR, a multiple-precision floating point library based on GMP. www.sagemath.org casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Integer dicision

2008-04-10 Thread casevh
>>> divmod(-9,2) (-5, 1) >>> divmod(9,2) (4, 1) casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: float / rounding question

2008-02-25 Thread casevh
mal (radix-10) number, 536/10 cannot be written exactly as a binary number. If you really need decimal numbers, use the Decimal class. See http://docs.python.org/tut/node16.html. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: How about adding rational fraction to Python?

2008-02-24 Thread casevh
e rationals and expect a constant running time. There are trade-offs between IEEE-754 binary, Decimal, and Rational arithmetic. They all have there appropriate problem domains. And sometimes you just need unlimited precision, radix-6, fixed-point arithmetic casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: How about adding rational fraction to Python?

2008-02-24 Thread casevh
thmetic where the total number of bits by the numerator and denominator was bounded. IIRC, a use case was matrix inversion. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for an interpreter that does not request internet access

2007-06-28 Thread casevh
oming from a corporate IT world, I'm not surprised that it is not reasonably configured casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I tell the difference between the end of a text file, and an empty line in a text file?

2007-05-16 Thread casevh
p end here > xx > xx > x > < loop should end here Assuming f is initialized as in your example, try - for s in f: print s - casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.5, problems reading large ( > 4Gbyes) files on win2k

2007-03-03 Thread casevh
offset += 1 if offset > end: offset = 0 loops += 1 if not loops % 1: print loops fh.close() if __name__ == '__main__': write_file(loops=150) read_file() casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: finding out the precision of floats

2007-02-27 Thread casevh
= Decimal(1) > False > >>> ((1.0/3.0)*3.0) == 1.0 > > True Try ((15.0/11.0)*11.0) == 15.0. Decimal is actually returning the correct result. Your example was just lucky. Decimal was intended to solve a different class of problems. It provides predictable arithmetic using &qu

Re: Python / Socket speed

2007-02-26 Thread casevh
window size > have something to do with it? > > Paul Tuning the TCP window size will make a big difference with Windows XP performance. I'm more curious about the original script. Either the test was against the loopback address, or he has a very impressive netork to sustain 1.8Gbit/s. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Rational numbers

2007-02-23 Thread casevh
py are you using? (What is gmpy.version()?) I just compiled Alex's most recent SVN version on Linux without any problems. I'll make Windows binaries next. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Rational numbers

2007-02-23 Thread casevh
x27;s interested in helping out is welcome to mail me and/or > use the "wiki" and "issues" entry of the Google Code gmpy site... > > Thanks, > > Alex I can keep building gmpy for Windows. I actually use MINGW since getting GMP compiled under MSVC is "challanging". I should be able to build new binaries for Windows this weekend. And I would be happy to point everyone to a real release. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Rational numbers

2007-02-23 Thread casevh
. Alex released versions 1.02 and 1.03 as CVS updates only. I think he may have made an announcement that 1.02 included alpha support for Python 2.5. 1.04a is 1.03 with one additional fix. I don't think there has been an official release, though. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Rational numbers

2007-02-23 Thread casevh
maintainer) to fix a bug found by mensanator. With Alex's permission, I released it as gmpy 1.04a. Alex has not updated cvs with the fix. gmpy 1.04a compiles cleanly with the latest releases of Python and GMP, so I consider it stable. > > Actually, gmpy is being maitained even

Re: code optimization (calc PI) / New Algorithme for PI

2007-01-04 Thread casevh
> Yes, this "gmpy" sounds good for calc things like that. > But not available on my machine. > ImportError: No module named gmpy What type of machine? The home page for gmpy is http://sourceforge.net/projects/gmpy/ I have Windows versions available at http://home.comcast.n

Re: code optimization (calc PI) / Full Code of PI calc in Python and C.

2007-01-04 Thread casevh
7; % (e + h)) e = i return ''.join(result) start_time = clock() pi = pi() print pi print "Total time elapsed:", round(clock() - start_time, 2), "s" print len(pi) casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: code optimization (calc PI) / Full Code of PI calc in Python and C.

2007-01-03 Thread casevh
econds. I tried a couple of optimizations but couldn't make any more improvements. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: A stupid question

2006-12-28 Thread casevh
you'll need. You could try uninstalling the bittorrent client and reinstalling a client with all its required dependencies. HTH, casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Python speed on Solaris 10

2006-11-14 Thread casevh
re CFLAGS, for example, so I just edited Makefile to suit my environment. You should set the values appropriate for you system, of course. I've also compiled Python using the Sun Studio compiler. Some tests were faster, some tests were slower. casevh -- > http://chrismiles.info/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Building C extensions

2006-11-06 Thread casevh
> PAolo Use mingw32. It should work fine for most extensions. For example, see http://groups.google.com/group/comp.lang.python/msg/8e2260fe4d4b7de9 and the followup messages. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: "best" rational number library for Python?

2006-10-31 Thread casevh
ly compiled GMP 4.2.1 on Solaris 10 x86 using both the > GCC and Sun Studio compilers on AMD 32-bit platform. > > I just compiled GMP 4.2.1 on a P4 using > > $ CFLAGS="" CC=gcc ./configure > $ gmake; gmake check > You must use "gmake". "make" fails during "make check" > and all tests passed. > > casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: "best" rational number library for Python?

2006-10-31 Thread casevh
32-bit platform. I just compiled GMP 4.2.1 on a P4 using $ CFLAGS="" CC=gcc ./configure $ gmake; gmake check and all tests passed. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: "best" rational number library for Python?

2006-10-31 Thread casevh
32-bit platform. I just compiled GMP 4.2.1 on a P4 using $ CFLAGS="" CC=gcc ./configure $ gmake; gmake check and all tests passed. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Fwd: Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-21 Thread casevh
> > The link for pexports-0.42h.zip is broken so I cant > test it on an extension. > pexports is only needed for Python 2.3. It is not required for 2.4 or 2.5. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Fwd: Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-21 Thread casevh
ecessary... I've used mingw32 to build gmpy for Python 2.5 without any problems. It looks like mingw32 works just fine with Python 2.5 (assuming the extension will compile with mingw32). casevh -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >