[PD] efficient cos calculation in externals?