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


Groups > comp.lang.python > #70280

Re: Simple question

References <534D7807.6050408@gmail.com>
Date 2014-04-15 14:28 -0400
Subject Re: Simple question
From Joel Goldstick <joel.goldstick@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.9286.1397586513.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Apr 15, 2014 2:19 PM, "Phil Dobbin" <phildobbin@gmail.com> wrote:
>
> Hi, all.
>
> I've just started to learn Python (I'm reading Mark Lutz's 'Learning
> Python' from O'Reilly) & I'm confused as to this part:
>
> '>>> 0.1 + 0.1 + 0.1 - 0.3
> 5.55111.....'
>
It's not. Look at the end of the result. It's scientific notation for a
very small number
> Using 'import Decimal' you can get a much closer result i.e.
> 'Decimal('0.0')'
>
> What I'm wondering is why the first calculation that arrives at
> '5.55111...' is so far out?
>
> Many thanks,
>
> Cheers,
>
>   Phil...
>
> --
> currently (ab)using
> CentOS 6.5, Debian Squeeze & Wheezy, Fedora 19 & 20, OS X Snow Leopard,
> RHEL 7, Ubuntu Precise & Saucy
> GnuGPG Key : http://phildobbin.org/publickey.asc
> Based in London, UK
>
> --
> https://mail.python.org/mailman/listinfo/python-list

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


Thread

Re: Simple question Joel Goldstick <joel.goldstick@gmail.com> - 2014-04-15 14:28 -0400

csiph-web