Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news.astraweb.com!border2.a.newsrouter.astraweb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!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; '(at': 0.04; 'bits': 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; 'default)': 0.16; 'digits.': 0.16; 'message-id:@4ax.com': 0.16; 'processors': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:> 50': 0.16; 'subject:default': 0.16; 'truncate': 0.16; 'seems': 0.21; '>>>': 0.22; 'print': 0.22; 'url:home': 0.24; 'math': 0.24; 'mon,': 0.24; 'least': 0.26; 'supported': 0.26; 'header:X-Complaints-To:1': 0.27; 'point': 0.28; 'decimal': 0.31; 'file': 0.32; "can't": 0.35; 'but': 0.35; 'skip:> 10': 0.36; 'charset:us-ascii': 0.36; 'example,': 0.37; 'received:76': 0.38; 'machines': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'most': 0.60; 'hardware': 0.61; 'back': 0.62; 'real': 0.63; 'default': 0.69; 'limit': 0.70; 'subject:Setting': 0.96; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Setting longer default decimal precision Date: Mon, 18 Nov 2013 20:29:43 -0500 Organization: IISS Elusive Unicorn References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-249-29-210.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384824591 news.xs4all.nl 15950 [2001:888:2000:d::a6]:48348 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:59930 On Mon, 18 Nov 2013 14:14:33 +0000, "Kay Y. Jheallee" declaimed the following: >Using 1/3 as an example, > > >>> 1./3 >0.3333333333333333 > >>> print "%.50f" % (1./3) >0.33333333333333331482961625624739099293947219848633 > >>> print "%.50f" % (10./3) >3.33333333333333348136306995002087205648422241210938 > >>> print "%.50f" % (100./3) >33.33333333333333570180911920033395290374755859375000 > >which seems to mean real (at least default) decimal precision The default double precision FLOATING POINT is limited to ~15 significant digits. That's a hardware limit for double on most machines (64-bits). Most floating point processors may use 80 bits internally, but truncate back down on output. Python has supported a DECIMAL package for some years, but math with that package will be slower as it can't go through the FPU. Check the help file for your installation, look for decimal -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/