Advertisement

1.0f vs. 1.0

Started by December 25, 2002 12:27 AM
1 comment, last by etaylor27 21 years, 10 months ago
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.
--"The greatest pleasure in life is in doing what people say you cannot do." -- Walter Bageholt
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
-----------------------"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
Advertisement
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.

This topic is closed to new replies.

Advertisement