Exchange and correlation energy of an inhomogeneous electron gas