use python as a calculator

ilovesss2004 yyiilluuoo at gmail.com
Thu Jun 24 12:33:12 EDT 2010


On Jun 24, 5:50 pm, Tim Harig <user... at ilthio.net> wrote:
> On 2010-06-24, ilovesss2004 <yyiillu... at gmail.com> wrote:
>
> > If I run
> > 1.0/10**10
> > python will return 0
>
> Python 2.6.4 (r264:75706, Dec 11 2009, 23:02:59)
> [GCC 3.4.6] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> 1.0/10**10
> 1e-10
>
> What version are you using?
>
> > How can I make python return 1e-10?
>
> If necessary, cast everything to a float:
>
>
>
>
>
> >>> 1.0/float(10**10)
> 1e-10

I use python 2.5
Must change version? Is there any other solution?



More information about the Python-list mailing list