Fixed-point implementation of ff_cos, ff_log2, ff_exp2.