Like I said, I think I just tacked it to the output without really knowing if it would help or make things worse. My main application for the PID routine is motor control and it's been over a decade since I initially wrote it. Now, with more knowledge gained, filtering the input signal or, as in your orginial question, the error prior to it getting to the derivative term may be better. Then again, I suppose it all depends on what issues you're trying to "fix".

If the input is noisy due to electrical noise perhaps some simple averaging is enough.

Keep us posted!