Skip to content

cospi

elfun · scripts/elfun/cospi.m

cospi (X)  --  cos (pi * X) without rounding pi * X.

X is reduced modulo 2 exactly, so odd multiples of 1/2 give exact zeros.
Complex input is handled by the angle-sum formula with the real part
reduced exactly.