replaced cos with cosf