Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30962
| 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 | <d@davea.name> |
| 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 <d@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
| MIME-Version | 1.0 |
| To | Chris Angelico <rosuav@gmail.com> |
| Subject | Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ? |
| References | <91ff9b33-c212-4be0-8ed0-1f6b16f56865@googlegroups.com> <5072E7CC.2070405@davea.name> <CAPTjJmons5fwExNOaug0dNsym2eLe5Pduh6cVqynSAPoSowQdQ@mail.gmail.com> |
| In-Reply-To | <CAPTjJmons5fwExNOaug0dNsym2eLe5Pduh6cVqynSAPoSowQdQ@mail.gmail.com> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1954.1349709246.27098.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
On 10/08/2012 11:00 AM, Chris Angelico wrote: > On Tue, Oct 9, 2012 at 1:48 AM, Dave Angel <d@davea.name> 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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ? iMath <redstone-cold@163.com> - 2012-10-08 07:07 -0700
Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ? Dave Angel <d@davea.name> - 2012-10-08 10:48 -0400
Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ? Chris Angelico <rosuav@gmail.com> - 2012-10-09 02:00 +1100
Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm � Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-09 11:39 +0000
Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ? Dave Angel <d@davea.name> - 2012-10-08 11:13 -0400
Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-10-08 16:44 +0200
Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ? Chris Angelico <rosuav@gmail.com> - 2012-10-09 02:19 +1100
Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ? Terry Reedy <tjreedy@udel.edu> - 2012-10-08 21:45 -0400
Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ? Dave Angel <d@davea.name> - 2012-10-08 22:20 -0400
csiph-web