Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: What is precision of a number representation? (was: Curious Omission In New-Style Formats) Date: Tue, 12 Jul 2016 09:57:44 +1000 Lines: 13 Message-ID: References: <834b1cce-38dd-474c-8915-4ff1cd6b27ec@googlegroups.com> <7fcc8c21-106f-41d4-a5ba-409f3b54a56d@googlegroups.com> <5783c91e$0$1622$c3e8da3$5496439d@news.astraweb.com> <5783D63F.5040307@stoneleaf.us> <8560sbvqqd.fsf_-_@benfinney.id.au> <20160712001452.4432d7d0@HP-6550b> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de Qw7JbVQqaJYrzP7NRvDzeA4C1PR9HcGCSa496VLCUaqg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'bits': 0.07; 'subject:number': 0.07; 'cc:addr:python-list': 0.09; 'part,': 0.09; 'jan': 0.11; 'subject: \n ': 0.15; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hardware.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aligned': 0.22; 'assign': 0.22; 'class,': 0.22; 'am,': 0.23; "python's": 0.23; 'header:In-Reply-To:1': 0.24; 'point.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'fixed': 0.31; 'point': 0.33; 'tue,': 0.34; 'received:google.com': 0.35; 'trouble': 0.35; 'but': 0.36; 'subject:: ': 0.37; '12,': 0.37; 'subject:-': 0.39; 'your': 0.60; 'necessarily': 0.63; 'jul': 0.72; 'chrisa': 0.84; 'to:none': 0.91; 'good,': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=NajRpinfxQEAZDJwcPpyJ7j7mE/YPQ4xTId2YqmRhqI=; b=XxCsQ6fHBuIcJb9SmVVPMid4AnSfGSReFDm5aWdBgweGWmBSv6J/orNwpuZ3fETC3v ls8rkdhX/QsKGaer0ZR7ZjxahY6XzDMVkQ05KGF2f+P1NfWPhYOqep6g+I+7sjgB7voo inkhycXXHKvZqpfL8qzxBV0X87xbqIENtNRoB6ToK4VhPisNbw29g8NUtAYK4tEalNou cQ3MeH2hmNf3aNHdDonnwT4BFdf+ZlKOJ7fPA0TqODmpGTeX1viYW8L8aOoNv6gbX3r7 r0OUKp4jcbUlfEQ+KnxzZ8h5llX5iM3cnFaN1RASEtUngtmwAH/jnXS4Fs21Asl+d8wu jofA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=NajRpinfxQEAZDJwcPpyJ7j7mE/YPQ4xTId2YqmRhqI=; b=hrhyT/RFNcn2wjXOwIbLr9dfjeS982G4BlNYGR8FvLGV9V2srXGU+5QykTavWlK6Tf n3sX7nbxe4qXOe/C7FugrtPSfitChBJ6juKAE5+LXRwWIXWz6vOoSWAgQrsF0p3XWDXd CsPI4c5X+oqoZeb1adw/hQE38gGOQd/wWO/ODEvmNJkwNyp8StuNyvVPUAGhcm1mmGu8 ViiVfLzQExwYhb6lftyVpVNtRWfYqemilNDvI1inzHsFTu8jH2TdQfy2nj0n3qDVVy9d hdpiTDT0w6kGf/C2feHrwumiSrvb2G0/1w8MewZ3J6ZVLMRw3xDqQi+95guC4gLIZ2Gt HXSQ== X-Gm-Message-State: ALyK8tKRnjRAETUWYFrssDmqZMcDpL2+VSrogfBN1i44fYeZdGWMi7DMZ2TgCVAOyLQxXmFDCPC8l/65fND/Kw== X-Received: by 10.194.47.138 with SMTP id d10mr1861624wjn.30.1468281465169; Mon, 11 Jul 2016 16:57:45 -0700 (PDT) In-Reply-To: <20160712001452.4432d7d0@HP-6550b> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <834b1cce-38dd-474c-8915-4ff1cd6b27ec@googlegroups.com> <7fcc8c21-106f-41d4-a5ba-409f3b54a56d@googlegroups.com> <5783c91e$0$1622$c3e8da3$5496439d@news.astraweb.com> <5783D63F.5040307@stoneleaf.us> <8560sbvqqd.fsf_-_@benfinney.id.au> <20160712001452.4432d7d0@HP-6550b> Xref: csiph.com comp.lang.python:111304 On Tue, Jul 12, 2016 at 9:14 AM, Jan Coombs wrote: > Thees all look good, but you may get into trouble if you trust a > PC with them! > > If the language/PC uses floating point representation then it > will assign a fixed number of bits for the fractional part, and > this will be left aligned in all/most hardware. PCs don't necessarily use floating point. Just check out Python's own decimal.Decimal class, or roll your own if you need to. ChrisA