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: 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: 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: 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: 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

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: 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

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: 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: 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: 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: gmpy 1.01 rc near... anybody wanna test>

2005-11-06 Thread casevh
I downloaded and tried the CVS version. Division still didn't work as expected. >>> import gmpy >>> gmpy.version() '1.01' >>> gmpy.mpz(9)//gmpy.mpz(4) Traceback (most recent call last): File "", line 1, in ? TypeError: unsupported operand type(s) for //: 'mpz' and 'mpz' >>> from __future__ impor

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-07 Thread casevh
Everything works fine with v1.16. I'm sure I was doing something wrong. I shouldn't be testing that late at night. ;-) It looks like the warning about "tp_compare" has been fixed. I will try to build a version for Windows, but that may take me a day or two. Thanks for the updates to gmpy! Case

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-08 Thread casevh
Alex Martelli wrote: > <[EMAIL PROTECTED]> wrote: > > > Everything works fine with v1.16. I'm sure I was doing something wrong. > > I shouldn't be testing that late at night. ;-) > > > > It looks like the warning about "tp_compare" has been fixed. > > I didn't touch tp_compare specifically, so the

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-09 Thread casevh
> > Will you be updating the information in setup.py file? > > Done, in the current CVS version. I will grab the CVS version and create installers. > > Which versions of Python do you want to support? > > I have tested gmpy with 2.3 and 2.4 on Mac, and those two and also 2.2 > on Linux. I think

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-10 Thread casevh
I've created Windows binaries for Python 2.3 and 2.4. It should be compatible with PentiumPro or later processors. They can be found at http://home.comcast.net/~casevh/ Case -- http://mail.python.org/mailman/listinfo/python-list

Re: LARGE numbers

2005-11-10 Thread casevh
. An early alpha-quality release is available at http://home.comcast.net/~casevh/ I also have release candidate versions of GMPY for Windows on that page. I'll try to get the next release and some demos up in a few days. Case -- http://mail.python.org/mailman/listinfo/python-list

Re: LARGE numbers

2005-11-11 Thread casevh
Already done for next version. Tentatively, there will be a package called "ar" (Arbitrary Radix) and the module will be called BigInt. I'm also working on an arbitrary radix BigFloat module. Case -- http://mail.python.org/mailman/listinfo/python-list

Re: LARGE numbers

2005-11-11 Thread casevh
Paul Rubin wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > As the author of gmpy, I'd like to point out that the speed difference > > isn't all that large, if all you're doing is ordinary arithmetic -- a > > few times at most (it can be better if you need some of GMP's > > functionality whi

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-11 Thread casevh
What processor are you running? I only have Windows running on an old Pentium 3. It is easy for me to build a version that will running on almost any recent processor. I'm willing to try and override the CPU detection and make a processor specific build for you. I won't be able to test it, though.

Re: backslash plague: paths containing "\a" somewhere

2005-11-24 Thread casevh
tim wrote: > trying to work with a directory in windows, that has "\a" in the full > pathname > > this works: > > >>> c = string.replace('c:\content\ce\cw\cvd', '\\', '\\') > >>> c > 'c:\\content\\ce\\cw\\cvd' > > this doesn't: > > >>> c = string.replace('c:\content\a\a\avd', '\\', '\\') > >>>

ANN: DecInt 0.3 - Arithmetic for very large decimal integers

2005-11-30 Thread casevh
16x slower than GMP but can actually be faster in some instances; for example, dividing a 2,000,000 digit number by an 800,000 digit number. DecInt can be found at http://home.comcast.net/~casevh/ (DecInt used to be called BigDecimal; I renamed it to avoid confusion with the "decimal"

Re: python speed

2005-12-01 Thread casevh
DecInt's division algorithm is completely general also. But I would never claim that Python code is faster than assembler. I believe that careful implementation of a good algorithm is more important than the raw speed of the language or efficiency of the compiler. Python makes it easy to implement

Re: Python Installation error on Solaris-9-SPARC

2005-07-14 Thread casevh
Madhu R. Vajrala wrote: > > 2. gunzip -c Python-2.4.1.tgz | tar xvf - > Use gtar. The Solaris tar does not hnadle long file names correctly. gtar should be found in /usr/sfw/bin. cvh -- http://mail.python.org/mailman/listinfo/python-list

Re: fastest postgresql module

2005-03-17 Thread casevh
With the round-trip time of 245ms, three seconds only allows for approximately 12 packet exchanges (roughly 24 total packets). I think latency is your problem. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread casevh
James Stroud wrote: > On Friday 25 March 2005 08:39 am, Ivan Van Laningham wrote: > > As far as grouping by indentation goes, it's why I fell in love with > > Python in the first place. Braces and so on are just extraneous cruft > > as far as I'm concerned. It's the difference between Vietnamese

Re: ANN: BigDecimal - decimal arithmetic on very large intergers

2005-04-01 Thread casevh
st native Python long support, the division algorithm is faster than the built-in division algorithm when the numbers are several tens of thousands digits long. Interestingly, BigDecimal can do division faster than GMP 3.1.x with numbers approximately 10 million digits in length. BigDecimal is fas

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: 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: 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: 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

ANN: DecInt 0.4 and processor specific GMPY binaries

2005-12-19 Thread casevh
ed at http://home.comcast.net/~casevh Enjoy, casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: recursive function return value problems

2005-12-28 Thread casevh
You have two calls to reTest and so reTest needs to return twice. One return is from the reTest(True) call back to reTest(False). The second return is from reTest(False) back to the prompt. What were you expecting to happen? -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python allow access to some of the implementation details?

2006-01-06 Thread casevh
I don't know of a way to directly access the internal structure of a long, but you can speed up your example. First, is the order of the commands > i=i>>1 > lstBitsBitwiseAnd.append(i&0x01) what you intend? The first low order bit is discarded because you've done the shift first. And an extr

Re: Python and Solaris 10

2006-01-12 Thread casevh
I've built it with both GCC and Sun Studio compilers. Try adding /usr/sfw/bin to your path. Or set CC=/usr/sfw/bin/gcc casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Solaris 10

2006-01-12 Thread casevh
It looks like it is finding c++ in /usr/local/bin. Is that the compiler you want to use? I was assuming you want to use the Sun provided GCC located in /usr/sfw/bin. Try CC=/usr/sfw/bin/gcc CXX=/usr/sfw/bin/g++ ./configure casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Marshal Obj is String or Binary?

2006-01-13 Thread casevh
apes the values so they can be displayed. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: a print bug?

2006-07-26 Thread casevh
; the customer" using print "%20.2f", then there will be a cent missing > here and there... why not smooth out that imperfection and return that > penny to the customer? (not that they really care). The decimal module will do what you want. One of its primary motivations was correct rounding for financial activities. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: Negative division bug?

2006-08-03 Thread casevh
negative > integers it seems to subtract one from the expected result. > That is the intended behavior. Look at the output of divmod(). >>> divmod(-1,100) (-1,99) Let (q,r) = divmod(d, v) with v > 0, the behavior is chosen so that 0<= r < v. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: (newbie) Float() and high precision

2006-08-10 Thread casevh
related tools. casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: News on versions modules for Python-2.5?

2006-10-06 Thread casevh
> And who can confirm that these modules are independent of Python version? > Gmpy I've compiled gmpy for Python 2.5. It is available at http://home.comcast.net/~casevh/ > (tip: I am on windows, and I don't can/know compile any module) casevh -- http://mail.python.o

Re: Compile python on Solaris 64bit

2006-10-12 Thread casevh
ompiled Python 2.5 successfully on 32-bit Intel platform. After running configure, I had to manually edit the generated Makefile to add the contents of CFLAGS. I've had difficulties with ctypes, too. To get a successful compile, I had to edit ffitarget.h (I think) and also use the Sun Studio Express 2 compiler suite. Or use gcc. > > thanks, > martijn 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
specially since I havent got MS visual studio... > and mingw is not supported... :-( mingw32 is supported and can compile many extensions. See the following post: http://groups.google.com/group/comp.lang.python/msg/8e2260fe4d4b7de9 If you meant something else with your comment, please expl

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

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: "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: "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: 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: 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: math.pow(x,y)

2006-06-11 Thread casevh
t 28 seconds) > whereas > b = str(a) takes forever! > > Regards > Sreeram > If you really want all 3,440,299 digits, use the DecInt module.. http://home.comcast.net/~casevh/ Using Python 2.4.3 on a 1.4Ghz Celeron, a=DecInt(34564323) ** 456356 takes 20 seconds. astr=str(a) takes j

Re: @func call syntax

2006-06-11 Thread casevh
hing syntax is trying to achieve. I haven't been able > to find any answer of on the google web and groups. > > TIA. @function_name is called a decorator. http://www.python.org/dev/peps/pep-0318/ http://docs.python.org/whatsnew/node6.html casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: maximum integer length?

2006-06-18 Thread casevh
ath >>> 200 * 1024 * 1024 * 15 * math.log10(2) 946958486.2000643 Since memory space is required for temporary storage of intermediate results, you won't actually be able to create a number that large if you only have 400 megabytes. casevh -- http://mail.python.org/mailman/listinfo/python-list

ANN: GMPY binaries for Windows 2.5

2006-09-01 Thread casevh
GMPY binaries for Python 2.5 are available at http://home.comcast.net/~casevh/ Notes They have not been extensively tested. This is based on the CVS version of gmpy and includes a patch (not yet in CVS) from Alex Martelli that resolves a bug with divm(). Please consider this an "unoff

ANN: GMPY binaries for Python 2.5

2006-09-01 Thread casevh
d the subject line to read "Python 2.5" instead of "Windows 2.5". Wasn't Windows 2.5 the result of running Windows 3.11 on a 386sx processor? ;-) Thanks for stirring up old memories. I wonder where my 3.11 disks are? casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: GMPY binaries for Windows 2.5

2006-09-01 Thread casevh
> > Notes > > > > They have not been extensively tested. > > They don't work. At least the Pentium4 binary doesn't work, > same problem as before. Is the patch installed? I found the problem. Updated binaries should be available in a couple of hours. I'll add a note to the web page. I tested

Re: How to build extensions on Windows?

2006-09-07 Thread casevh
> 1. Get MinGW gcc and/or g++, preferably via MinGW installer from [1]. > You may have to restart your computer or manually edit PATH system > environment variable to include MinGW's bin directory (default is > c:\mingw\bin). Then check if it is there by typing `path` in the cmd > window. 1a. [Opt

Re: newbie division question

2006-09-18 Thread casevh
me way to avoid importing > from __future__ in module after module? Start python with the "-Qnew" option. > > Thanks, > Alan Isaac casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie division question

2006-09-18 Thread casevh
> PS Any news on when true division will be the default? Python 3.0 (aka P3K). It is the release that can break backwards compatibility. http://www.python.org/dev/peps/pep-3000/ casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: python interpreter on solaris 10

2006-09-25 Thread casevh
r/bin/python /usr/lib/python2.4/idlelib/idle.py casevh -- http://mail.python.org/mailman/listinfo/python-list

Re: python interpreter on solaris 10

2006-09-25 Thread casevh
n. Solaris Express ( stable development snapshots, usually released every two weeks or so) provide Python 2.4 as /usr/bin/python. I would try to use the python executable located in /usr/bin if it is exists, otherwise use the python executable in /usr/sfw/bin. 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: 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: 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) / 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: writing large files quickly

2006-01-27 Thread casevh
rbt wrote: > I've been doing some file system benchmarking. In the process, I need to > create a large file to copy around to various drives. I'm creating the > file like this: > > fd = file('large_file.bin', 'wb') > for x in xrange(40960): > fd.write('0') > fd.close() > > This takes a fe

Re: writing large files quickly

2006-01-27 Thread casevh
Oops. I did mean fd.write(block) The only limit is available memory. I've used 1MB block sizes when I did read/write tests. I was comparing NFS vs. local disk performance. I know Python can do at least 100MB/sec. -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended version of gcc for Python?

2005-05-16 Thread casevh
On Ubuntu, I have tried 3.3.4, 3.4.3 and 4.0. Compile and make test ran successfully with all three. For my benchmark, platform, and compiler options, 3.4.3 was the fastest by approximately 2%. I would normally use the default compiler for your distribution. casevh -- http://mail.python.org

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: 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: 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
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
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: 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: 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 trig precision problem

2006-05-18 Thread casevh
'd assume you are exceeding the precision available with standard 64-bit floating point. Here is a library for extended precision floating point, including trig functions. http://calcrpnpy.sourceforge.net/clnumManual.html 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: 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: 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: 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: 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
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: 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: 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: 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: 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-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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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

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

  1   2   >