Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #112011

Re: Float

From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: Float
Date 2016-07-29 20:25 +1000
Message-ID <mailman.20.1469787948.6033.python-list@python.org> (permalink)
References <da5a1bae-813f-4fef-a7b6-f67f258bcc85@googlegroups.com> <85bn1gpwpy.fsf@benfinney.id.au>

Show all headers | View raw


Cai Gengyang <gengyangcai@gmail.com> 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.

<URL:https://en.wikipedia.org/wiki/Floating_point>

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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Float Cai Gengyang <gengyangcai@gmail.com> - 2016-07-29 02:44 -0700
  Re: Float Lutz Horn <lutz.horn@posteo.de> - 2016-07-29 11:56 +0200
  Re: Float Ben Finney <ben+python@benfinney.id.au> - 2016-07-29 20:25 +1000
  Re: Float Steven D'Aprano <steve@pearwood.info> - 2016-07-30 00:26 +1000
    Re: Float Cai Gengyang <gengyangcai@gmail.com> - 2016-07-30 03:21 -0700
      Re: Float Steven D'Aprano <steve@pearwood.info> - 2016-07-30 20:34 +1000
        Re: Float Cai Gengyang <gengyangcai@gmail.com> - 2016-07-30 04:44 -0700
          Re: Float Chris Angelico <rosuav@gmail.com> - 2016-07-30 21:51 +1000
            Re: Float Rustom Mody <rustompmody@gmail.com> - 2016-07-30 20:20 -0700
              Re: Float Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-08-04 00:28 -0700
          Re: Float Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-07-30 12:03 -0400
          Re: Float eryk sun <eryksun@gmail.com> - 2016-07-30 18:19 +0000

csiph-web