The page Exact_trigonometric_constants has a bit of a longer discussion on this, but I don't quite get the math.