Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'see:': 0.07; 'subject:released': 0.07; 'function,': 0.09; 'function:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'message-id:@post.gmane.org': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:library': 0.16; 'subject:python': 0.16; 'stefan': 0.19; 'header:User-Agent:1': 0.23; 'example.': 0.24; 'header:X-Complaints-To:1': 0.27; 'especially': 0.30; 'decimal': 0.31; 'writes:': 0.31; 'probably': 0.32; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'to:addr:python- list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'number,': 0.60; 'numbers': 0.61 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Krah Subject: Re: python decimal library dmath.py v0.3 released Date: Tue, 4 Mar 2014 21:35:48 +0000 (UTC) References: <55fc232e-f1a5-4c28-8fc0-06b3e3c63a68@googlegroups.com> <44cb976d-cb25-468a-8525-edbf4b539f60@googlegroups.com> <1ba60da3-93d4-4bca-ab96-9f94e6afe519@googlegroups.com> <27d19767-84ee-4ab7-87fd-784e8ac57680@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 85.179.175.115 (Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393969211 news.xs4all.nl 2914 [2001:888:2000:d::a6]:37905 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67726 [I found this via the python-ideas thread] Wolfgang Maier biologie.uni-freiburg.de> writes: > math.factorial is accurate and faster than your pure-Python function, especially for large numbers. It is slower for huge numbers than decimal if you use this Python function: http://www.bytereef.org/mpdecimal/quickstart.html#factorial-in-pure-python Be sure to set MAX_EMAX and MIN_EMIN, that's missing in the example. If you want to *see* all digits of a very large number, then decimal is probably even faster than gmpy. See: http://www.bytereef.org/mpdecimal/benchmarks.html#arbitrary-precision-libraries Stefan Krah