[vtkusers] Re: Float to Int

Russell Hind rh_gmane at mac.com
Wed Jul 19 07:22:12 EDT 2006


Patrícia Gonçalves wrote:
> I'm not familiar with Tcl and I don't know if it has a Round method, but 
> you can make one yourself:
> 
>     float j = (number);
>     int i = j;        // making i equal to the floor of (number)
>     if (j-i>=0.5) i=i+1;
> 

Why not just

float j = (number);
int i = (j + 0.5f);

Cheers

Russell




More information about the vtkusers mailing list