Color to grayscale algorithm

Thanks @glv

I am familiar with casting a double to a float in a similar way:

double dopple = 6.28318530717958647693d;
float boat = (float) dopple;

because float() expects an integer and not a double
float ship = float(dopple); //does not work

But why (int) somenumber and not int(somenumber)???