Exact and approximate calculation of giant resonances