A modified fast cosine transform (FCT) algorithm is presented featuring the following three properties: (1) the entire calculation is performed using arrays half the size of what would be required using a common fast Fourier transform (FFT); (2) the result of the FCT is identical to that which would be obtained using an FFT and an array double the size; (3) the FCT is its own inverse. The algorithm requires a minor modification to the FCT algorithm in Numerical Recipes by W.H. Press et al., which satisfies only the first of the above three properties. An extension of fast sine/cosine transform algorithms to the case of complex data is included. Programs written in Fortran 77 for both real and complex versions are provided.