Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'interpreter': 0.04; 'true,': 0.04; 'binary': 0.05; 'float': 0.05; 'removes': 0.05; 'python': 0.09; 'cc:addr:python-list': 0.10; "wouldn't": 0.11; 'subject:python': 0.11; '1:48': 0.16; '3.2.': 0.16; 'ah,': 0.16; 'binary.': 0.16; 'formed,': 0.16; 'later).': 0.16; 'oct': 0.16; 'wrote:': 0.17; 'intel': 0.17; 'import': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'machine': 0.24; 'tried': 0.25; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(which': 0.26; 'am,': 0.27; 'guess': 0.27; 'operations,': 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; 'anybody': 0.32; 'doubt': 0.33; 'largely': 0.33; 'skip:d 20': 0.34; 'done': 0.34; 'machines': 0.35; 'possible': 0.37; 'being': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'sincerely': 0.60; 'within': 0.64; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'subjectcharset:utf-8': 0.72; '100': 0.78; 'subject:get': 0.81; 'copy-paste': 0.84; 'float,': 0.84; 'subject:value': 0.84; 'apparent': 0.91; 'dozen': 0.91; 'angel': 0.93 Date: Mon, 08 Oct 2012 11:13:42 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: Chris Angelico Subject: =?UTF-8?B?UmU6IFRvIGdldCB0aGUgYWNjdXJhdGUgdmFsdWUgb2YgMSAtIDAuOTk=?= =?UTF-8?B?OTk5OTk5OTk5OTk5OSAsaG93IHRvIGltcGxlbWVudCB0aGUgcHl0aG9uIGFsZ28=?= =?UTF-8?B?cml0aG0g77yf?= References: <91ff9b33-c212-4be0-8ed0-1f6b16f56865@googlegroups.com> <5072E7CC.2070405@davea.name> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:mFCZu0hzVMeDcLrHVDge+0lmhPMdkHHScwjlSExn3LC GQLICk8aKS4dkZxRUZgWwrDn0VCIYyOjHQY0Z6u3GiM7b1ueDm 2kFRIw32Ct5wPhgZ1ME75kRMYKz3iKzOQrE1TcrjrHNrFpL48+ KU0S7y4xtc7zSyOabXk2Ya4OEcbwQZmTbmv3YmXGcS6Ub/479Q RLrrbvny6KKi7qGrZHnR2CyRA7manroGY7dy8fVydJQ+xngsX9 VQgdtPnciAMdNel4TM3R1l+7jdvGHWXdNqRJ3K/a1Ysc3CJpHM nAdbmZFJQP+Wof+O/LpiwVJAF1ID4FXKfQ2wO+fYE12RSM8MA= = Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349709246 news.xs4all.nl 6870 [2001:888:2000:d::a6]:40497 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30962 On 10/08/2012 11:00 AM, Chris Angelico wrote: > On Tue, Oct 9, 2012 at 1:48 AM, Dave Angel wrote: >> import decimal >> a = decimal.Decimal(4.3) >> print(a) >> >> 5.0999999999999996447286321199499070644378662109375 > Ah, the delights of copy-paste :) > >> 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? -- DaveA