Type conversion mysteries ?

Emile van Sebille emile at fenx.com
Thu Sep 13 07:58:54 EDT 2001


"Georg Hoermann" <georg at toppoint.de> wrote in message
news:qa71qtg73mtf7sb404qnh84r3kbjaf6olp at 4ax.com...
> Hello World,
>
> can someone please explain these results:

It's the order the calculations are done in.

>
> print 100.0*1200/2450   is 48

here you create a float 120000.0 then divide by 2450 to get 48

> print 1200/2450*100.0 gives 0 (zero ?!)

here you integer divide 1200/2450 to get 0 then multiply by 100.0

This will (very likely) change in a futuure release.

>
> Thanks,
> Georg

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list