Sebastian Egner asked about a function to test whether a given cyclotomic
field element is a root of unity.
The following article by my colleagues at Bath
is highly relevant:
"Effective Tests for Cyclotomic Polynomials," in Proceedings of ISSAC 1988, Springer LNCS no.~368, P.~Gianni (Ed). (R..J.~Bradford and J.H.~Davenport) MR 90m:11201 (11Y16; 11Y40). (1989)