Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: Float Date: Fri, 29 Jul 2016 20:25:29 +1000 Lines: 28 Message-ID: References: <85bn1gpwpy.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de 09/N+oK3QAzxnUMbEL++QgqiBKx4b6ndTp7zLwXYIvCQ== Cancel-Lock: sha1:o3Z2vX6s/0RcRtOkhIC9HvWA0ro= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'bits': 0.07; 'compute': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'appropriate': 0.14; 'numbers;': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'rights,': 0.16; 'substitute': 0.16; 'integer': 0.18; 'fraction': 0.22; 'decide': 0.23; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'not.': 0.27; 'values': 0.28; 'decimal': 0.29; 'url:wikipedia': 0.29; 'url:wiki': 0.30; 'maybe': 0.33; 'but': 0.36; 'there': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'support,': 0.37; 'whom': 0.37; 'someone': 0.38; 'represent': 0.38; 'means': 0.39; 'url:en': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'matter': 0.63; 'information': 0.63; 'rose': 0.72; '_o__)': 0.84; 'received:125': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) 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: <85bn1gpwpy.fsf@benfinney.id.au> X-Mailman-Original-References: Xref: csiph.com comp.lang.python:112011 Cai Gengyang writes: > Can someone explain in layman's terms what "float" means ? They are a compromise: in a known number of bits and with explict very-fast hardware support, represent numbers at a large range of scales. The compromise is that the values have limited precision for representing those numbers. If you want exact representations of numbers, you don't want floating-point numbers; you want Fraction or Decimal or integer etc. If you just want to have fairly-good precision of fractional numbers, as fast as your computer can compute them, then maybe the built-in floating-point numbers are what you want. There is no substitute for knowing the characteristics of floating-point numbers, and using that information to decide when they are appropriate and when they are not. -- \ “Books and opinions, no matter from whom they came, if they are | `\ in opposition to human rights, are nothing but dead letters.” | _o__) —Ernestine Rose | Ben Finney