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


Groups > comp.lang.python > #112056

Re: Float

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Float
Date 2016-07-30 21:51 +1000
Message-ID <mailman.45.1469879492.6033.python-list@python.org> (permalink)
References (1 earlier) <579b67b0$0$1614$c3e8da3$5496439d@news.astraweb.com> <367666cb-224f-4b16-88bb-cd1ada13a13b@googlegroups.com> <579c82a6$0$1619$c3e8da3$5496439d@news.astraweb.com> <e5d77dc3-2fe4-4352-9582-8a259f3c4f9d@googlegroups.com> <CAPTjJmri1uAicp_VnZ+b3+goWASGkW4yaAKJdLqcbs2N72Sz_Q@mail.gmail.com>

Show all headers | View raw


On Sat, Jul 30, 2016 at 9:44 PM, Cai Gengyang <gengyangcai@gmail.com> wrote:
> You mentioned that : A floating point number[2] is number that is not an integer (and not a
> complex number)
>
> Hence ,
>
> 10 is not a floating point number because it is an integer
> 25 is not a floating point number because it is an integer
> 7 + 3i is not a floating number because it is a complex number
> 8 + 5i is not a floating number because it is a complex number.
>
> Is 3.0 a floating number ? It is a rational number, not an integer right ?

In a computing context, data types are incredibly significant. So yes,
3.0 *is* a floating-point number. It's equal to the integer 3, because
they represent the same number, but it's not identical to it. You can
convert from one to the other with the built-ins int and float:

>>> 3.0 == 3
True
>>> int(3.0)
3
>>> float(3)
3.0

ChrisA

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