We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Floats and ints (Read 594 times)
Floats and ints
Mar 13th, 2007, 6:12pm
 
Does anyone know of a way in which I can convert a floating point number to an int? Basically, I'd like to cut off everything to the right of the decimal, and declare it an integer.
Re: Floats and ints
Reply #1 - Mar 13th, 2007, 6:57pm
 
float b=3.141;
int a=(int)b;
Re: Floats and ints
Reply #2 - Mar 13th, 2007, 8:06pm
 
Thanks man, worked like a charm.
Page Index Toggle Pages: 1