# Digital lowpass filter causing aliasing

I'm writing a biquad filter program in C++, using the LBJ Cookbook as the source for the formulas. https://webaudio.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html The lowpass filter that I've made seems to half work. The frequencies above the cutoff are being attenuated, however, it is causing aliasing similar to what happens with frequencies above Nyquist's limit.

double output, a0, a1, a2, b0, b1, b2, w, alpha;
double pi = 3.14159265359;
w = (2 * pi) * (cutoff / sampleRate);
alpha = (sin(w)) / 2 * q;
a0 = 1 + alpha;
a1 = -2 * cos(w);
a2 = 1 - alpha;
b0 = (1 - cos(w)) / 2;
b1 = 1 - cos(w);
b2 = (1 - cos(w)) / 2;

output = (b0 / a0) * inSamples[0] + (b1 / a0) * inSamples[1] + (b2 / a0) * inSamples[2]
- (a1 / a0) * outSamples[0] - (a2 / a0) * outSamples[1];


I'm not sure where my error is, so any help is greatly appreciated!

your output is definitely a linear combination of previous in- and output samples.