Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

etaylor27

1.0f vs. 1.0

This topic is 5748 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m not sure this question belongs in the beginners sections, but I''m starting out in DirectX and I''m not completely experienced as a programmer, but I was hoping someone could clear up something that''s been troubling me that I''ve seen in documentation. Just about all of the colors and points are defined by numbers that look like 0.5f with that ''f'' in back of it... could someone help me understand what that signifies? Sorry if this is a really dumb question, but I didn''t know where else to look.

Share this post


Link to post
Share on other sites
Advertisement
It signifies that the value should be treated as a float. A value such as 0.5 will by default be treated as a double.

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack

Share this post


Link to post
Share on other sites
To expand on what Maximus said, a float, defined by the keyword float, and who''s constants are defined with an f preceding value (0.5f) are stored in 32 bit words. The double, which, suprise, stores double the procession of a float, is 64 bits wide and is denoted with the keyword double, and indicated in constants as 0.5. Using doubles increases precision but at the cost of larger memory consuption and bandwidth.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!