Fast Fourier transform for discontinuous functions