Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin.stu.neva.ru!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'interpreter': 0.04; 'true,': 0.04; 'binary': 0.05; 'float': 0.05; 'removes': 0.05; 'url:pipermail': 0.05; 'python': 0.09; 'itself.': 0.11; "wouldn't": 0.11; 'subject:python': 0.11; '1:48': 0.16; '3.2.': 0.16; 'binary.': 0.16; 'formed,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'later).': 0.16; 'oct': 0.16; 'wrote:': 0.17; 'intel': 0.17; '>>>': 0.18; 'received:209.85.214.174': 0.21; 'machine': 0.24; 'tried': 0.25; 'least': 0.25; 'header:In-Reply-To:1': 0.25; '(which': 0.26; 'am,': 0.27; 'guess': 0.27; 'list:': 0.27; 'operations,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'chris': 0.28; 'argue': 0.29; 'decimal': 0.29; 'factor': 0.29; 'class': 0.29; "i'm": 0.29; 'maybe': 0.29; 'function': 0.30; 'point': 0.31; 'url:python': 0.32; 'anybody': 0.32; 'doubt': 0.33; 'largely': 0.33; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'done': 0.34; 'machines': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'possible': 0.37; 'being': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'sure': 0.38; 'gives': 0.39; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'url:mail': 0.40; 'sincerely': 0.60; 'within': 0.64; 'account': 0.67; 'subjectcharset:utf-8': 0.72; '100': 0.78; 'subject:get': 0.81; 'float,': 0.84; 'python-dev': 0.84; 'subject:value': 0.84; 'url:python-dev': 0.84; 'apparent': 0.91; 'dozen': 0.91; 'angel': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=K7ztSa3VfZp1ko7Zubl4u25lkVkv817WrgmiiDsM7tI=; b=rSq5mMUBh4V5lx4kn74u6Fzn8qnrl0EneMAoEhuJPv3JRAgHguowuXSOx41FdXXRdd RmJnYi/6wA4czYglBddohzSphG6TFXe9ImrCIRIeqM0dMzo1TNCvI6rIZBQRVvhIdgFS bUoKlRTuYGrst7v4oXM9XC3EqDCDqcL/iwV9DZPrk3kQyVkPE17woWKhzQCvbiZpPXJT 6uXyzqxzu8pGsVCnYc6r/jzEnBW1ZqUT31VFPP1JhXkfV44XC/l5bBSsxnkYRlZlhIpS Vgo1LHlc5cNEVuseEckaaQTEJhz4PKiU/qOkm10Ona/HiKST41zQRq0Xd4TZlRZmhr3f zdDQ== MIME-Version: 1.0 In-Reply-To: <5072EDA6.6040202@davea.name> References: <91ff9b33-c212-4be0-8ed0-1f6b16f56865@googlegroups.com> <5072E7CC.2070405@davea.name> <5072EDA6.6040202@davea.name> Date: Tue, 9 Oct 2012 02:19:04 +1100 Subject: =?UTF-8?Q?Re=3A_To_get_the_accurate_value_of_1_=2D_0=2E9999999999999?= =?UTF-8?Q?99_=2Chow_to_implement_the_python_algorithm_=EF=BC=9F?= From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349709548 news.xs4all.nl 6847 [2001:888:2000:d::a6]:44392 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30964 On Tue, Oct 9, 2012 at 2:13 AM, Dave Angel wrote: > On 10/08/2012 11:00 AM, Chris Angelico wrote: >> On Tue, Oct 9, 2012 at 1:48 AM, Dave Angel wrote: >>> The Decimal class has the disadvantage that it's tons slower on any modern machine I know of... >> Isn't it true, though, that Python 3.3 has a completely new >> implementation of decimal that largely removes this disadvantage? >> >> ChrisA > > I wouldn't know, I'm on 3.2. However, I sincerely doubt if it's within > a factor of 100 of the speed of the binary float, at least on > pentium-class machines that do binary float in microcode. A dozen years > or so ago, when the IEEE floating point standard was still being formed, > I tried to argue the committee into including decimal in the standard > (which they did much later). Had it been in the standard then, we MIGHT > have had decimal fp on chip as well as binary. Then again, the standard > was roughly based on the already-existing Intel 8087, so maybe it was > just hopeless. > > I guess it's possible that for some operations, the cost of the > byte-code interpreter and function lookup, etc. might reduce the > apparent penalty. Has anybody done any timings? Try this, from python-dev list: http://mail.python.org/pipermail/python-dev/2012-September/121832.html It's not as fast as float, but it sure gives a good account for itself. ChrisA