It is will give you the right results if you use int(round(f, 0)) On Fri, Nov 9, 2012 at 1:55 PM, Stephen Blair <[email protected]>wrote:
> int(x) is such that"If *x* is floating point, the conversion truncates > towards zero. " > I understand that to mean int() drops the decimal part. > > Today, I couldn't repro what you described, but I saw a bunch of support > cases like that back at Softimage. > > > On 09/11/2012 1:46 PM, Bradley Gabe wrote: > > Yup, they are type double, but I was assuming the int() function would do > a more intelligent conversion. > > Have to do int(round(value)) whenever converting from float to int. > > On Fri, Nov 9, 2012 at 12:42 PM, Stephen Blair > <[email protected]>wrote: > >> Playcontrol values are floating point, so sometimes you don't get back >> an exact integer >> and >> print int( 99.999 ) will print 99 >> >> >> >> >> >> >> On 09/11/2012 1:23 PM, Bradley Gabe wrote: >> >> Opening a new XSI scene, the frame range is set from 1 to 100 by default. >> If I run the following Python code: >> >> print Application.GetValue("PlayControl.Out") >> >> the output is 100.0 >> >> >> if I try to directly convert it to an integer: >> >> print int(Application.GetValue("PlayControl.Out")) >> >> the output is 99 >> >> Anyone know what is going on? >> >> >> > > --

