Archived

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

etaylor27

1.0f vs. 1.0

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
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