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.
IndexProgramming Questions & HelpSyntax Questions › What does this stand for
Page Index Toggle Pages: 1
What does this stand for? (Read 262 times)
What does this stand for?
Nov 27th, 2008, 9:06am
 
sometimes i see some numbers, that is followed by 'f'

Here is an example from Daniel Shifmans site
I've seen it else where as well,in other code examples, what does it mean?
http://www.shiffman.net/teaching/nature/forces/

void update() {
 vel.add(acc);
 loc.add(vel);
 acc.setXY(0.0f,0.0f); // new!
}
Re: What does this stand for?
Reply #1 - Nov 27th, 2008, 9:36am
 
these are floats.

if you write 1.0 it's a double number, if you put a 'f' behind a number it's a float (e.g. 1f or 1.0f).

Re: What does this stand for?
Reply #2 - Nov 27th, 2008, 11:11am
 
Ilu wrote on Nov 27th, 2008, 9:36am:
these are floats.

if you write 1.0 it's a double number, if you put a 'f' behind a number it's a float (e.g. 1f or 1.0f).


Actually that's only true in Java, in Processing 1.0 is taken to be a float not a double, since Processing defaults to floats for everything. To make a number a double you'd have to suffix it 'd' I think
Page Index Toggle Pages: 1