The Goertzel algorithm is a technique in digital signal processing (DSP) that provides a means for efficient evaluation of individual terms of the discrete Fourier transform (DFT)
It exists in C as a rounding function when combined with an integer cast. The Matlab round function will do this automatically.
I notice it seems to still enable correct frequency detection but the the output magnitude is affected - producing an inaccurate normalised magnitude output (when dividing the output by number of samples).