Add cosine value calculation