Base conversion method or module

Mensanator mensanator at aol.compost
Mon Dec 8 23:57:18 EST 2003


>Subject: Re: Base conversion method or module
>From: Jeff Wagner JWagner at hotmail.com 
>Date: 12/8/2003 1:01 AM Central Standard Time
>Message-id: <0b88tvo38l9ca8fhc3127mskqegdpfocn7 at 4ax.com>
>
>On 08 Dec 2003 04:45:17 GMT, mensanator at aol.compost (Mensanator) wrotf:
>
>>>Subject: Re: Base conversion method or module
>>>From: "Francis Avila" francisgavila at yahoo.com 
>>>Date: 12/7/2003 8:52 PM Central Standard Time
>>>Message-id: <vt7pt71h3bsf78 at corp.supernews.com>
>>>
>>>
>>>Jeff Wagner wrote in message ...
>>>>On Mon, 8 Dec 2003 00:40:46 +0100, "Fredrik Lundh"
><fredrik at pythonware.com>
>>>wrotf:
>>>>
>>>>>Jeff Wagner wrote:
>>>>>
>>>>>> I found the Python cookbook recipe you were referring to. It is as
>>>follows:
>>>>>
>>>>>(what's wrong with just posting an URL?)
>>>>
>>>>What a great idea ;)  ...
>>>>http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/111286
>>>
>>>Hey, I found another one which is the more general "inverse of int/long"
>>>function I was pining for (and thus learning for the n-th time that one
>>>should check the cookbook first before reinventing the wheel):
>>>
>>>http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/222109
>>
>>These are nice, but they're very slow:
>>
>>For i=2**177149 - 1
>>
>>224.797000051 sec for baseconvert
>>202.733999968 sec for dec2bin (my routine)
>>137.735000014 sec for radix
>>
>>Compare those to the .digits function that is part of GMPY
>>
>>0.59399998188 sec
>>
>>That can make quite a difference when you're running through a couple
>million
>>iterations.
>
>So I decide to go and try out this GMPY and download the win32 binaries. It
>consists of two files,
>gmpy.pyd and pysymbolicext.pyd ... what do I do with them, just copy them to
>the lib folder?

Yes. Did you get the documentation files also? You'll want gmpydoc.txt as it
lists all the functions. Unfortunately, it's a Unix test file (no carraige
returns) making it useless for Windows Notepad unless you convert the line
feeds to carraige return/line feed.

>
>Then it says I need GMP-4.x so I get that, too. It's like nothing I've ever
>seen before. How can I
>install that on my WinXP box?

You only need that if you are going to compile from the source files. The
Windows binaries are already compiled, so you shouldn't need to do that step.

>
>Thanks, Jeff



--
Mensanator
Ace of Clubs




More information about the Python-list mailing list