Game Development Community

640.0f?

by Steve Way · in Technical Issues · 02/06/2002 (12:20 pm) · 4 replies

**blush**

Sorry, I know this is a really dumb question, but the answer has slipped my mind. What is the significance of the f after some numbers in C++ code?

Thanks.

#1
02/06/2002 (12:43 pm)
The compiler interpets them as floats.
#2
02/06/2002 (4:33 pm)
As opposed to doubles.
#3
02/06/2002 (4:42 pm)
Without the 'f' most compilers will default to doubles and the resulting math operations will be much slower. Unless you need double accuracy you should always use 'f' on all your constants.
#4
02/06/2002 (4:42 pm)
Aah, thank you!