Calc it in actual angles, not in cos, since cos is not linear, so you had very smooth attenuation gradient near 0, and very sharp near 180, you can see that just by looking at cos graph near 0 and near Pi/2.

In code you should calc:

rhoAngle = acos(rho); lightAngleCos = acos(lightAngleCos);

and then use it to calc attenuation: