Fun with numbers - dammit, but I want a cast!

Istvan Albert ialbert at mailblocks.com
Mon Aug 11 09:47:09 EDT 2003


Graham Nicholls wrote:

>>Have you tried doing it this way:
>>xscale = xframe / float(img_x)
> 
> 
> Thats what I wanted to do, but was sure I'd read that python didn't have
> casts, and that _looks_ like a cast to me!

You can also force floating point math by muliplying with 1.0
before the division:

xscale = 1.0 * xframe/img_x

Istvan.





More information about the Python-list mailing list