I saw "1/3.f" in a program, and wondered what the ".f" was for. So tried my own program:
using namespace std;
.f the number gets interpreted as an integer, hence
(int)0 instead of the desired
.f tells the compiler to interpret the literal as a floating point number of type float. There are other such constructs such as for example
0UL which means a
(unsigned long)0, whereas a plain
0 would be an
.f is actually two components, the
. which indicates that the literal is a floating point number rather than an integer, and the
f suffix which tells the compiler the literal should be of type float rather than the default double type used for floating point literals.
Disclaimer; the "cast construct" used in the above explanation is not an actual cast, but just a way to indicate the type of the literal.
If you want to know all about literals and the suffixes you can use in them, you can read the C++ standard, (1997 draft, C++11 draft, C++14 draft) or alternatively, have a look at a decent textbook, such as Stroustrup's The C++ Programming Language.
As an aside, in your example
(float)1/3 the literals
3 are actually integers, but the 1 is first cast to a float by your cast, then subsequently the 3 gets implicitly cast to a float because it is a righthand operand of a floating point operator. (The operator is floating point because its lefthand operand is floating point.)