Jump to content

  • Log In with Google      Sign In   
  • Create Account

What does the f mean?


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1   Members   

122
Like
Likes
Like

Posted 26 August 2001 - 04:18 PM

This has got to be a newbie question that I never took the time to figure out. But what is that ''f'' that I see on the end of floats and numbers in several OpenGL graphics functions/tutorials/books. Is it just a shortcut to make it a float or something; I can''t find any information about it in my OpenGL book or any C/C++ programming book for that matter. I notice the functions perform the same thing without the ''f''s but why are they there? Is it necessary to have them? Here is an example: glVertex3f(0.0f, -10.0f, 0.0f); // What is the f? or glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 40.0f); // What is the f? etc. Any help would be GREATLY appreciated!

#2   Members   

1087
Like
Likes
Like

Posted 26 August 2001 - 04:24 PM

The ''f'' means it''s a float, not a double. If you take away the ''f'', it is a double, and ends up getting converted to a float.

[Resist Windows XP''s Invasive Production Activation Technology!]

#3   Members   

128
Like
Likes
Like

Posted 26 August 2001 - 04:25 PM

The ''f'' tells the compiler that the floating point number is a single-precision number (four bytes) as opposed to the default of a double-precision number (eight bytes).

Steve ''Sly'' Williams  Code Monkey  Krome Studios




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.