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

Graham Nicholls graham at rockcons.co.uk
Mon Aug 11 11:37:38 EDT 2003


Istvan Albert wrote:

> 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.
Thanks everybody!  I'm now sorted with numbers.  At least 2.0+2.0 now equals
about 4.0, anyway.
Graham
-- 
Graham Nicholls
Rock Computer Consultancy





More information about the Python-list mailing list