Why is this IIR Filter unstable on the Arduino Due?
The precision of a float is about 7 significant digits. The
constant term of B in your transfer function (0.00000376) has only 3
significant digits.
Your transfer function has a pole at z = 1. It is thus not really
stable, but only marginally stable. Any parasite DC component in
the input will make the output drift without bounds.


It seems to me that your problem is not related to the implementation of
the filter on the Arduino, but rather to the filter design. Where did
you get that transfer function from?

Edit: I looked at the filter you are trying to make. It turns out it
is very sensitive to the precision of the coefficients of A(z). If you
try to add these coefficients, they almost cancel out: their sum is
about 3e-5. At zero frequency, both A and B are 3e-5, and the transfer
function, which is their ratio, is 1. By rounding the coefficients to
four decimal places, you made the cancellation exact, and the transfer
function infinite.

Just write the transfer function with more decimal places in the
coefficients and it should work:

H(z) = 3.75592×10−6 (1 + 3 z−1 + 3 z−2 + z−3)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;÷ (1 − 2.9371759 z−1 + 2.8763097 z−2 − 0.9391038 z−3)