1. An analog circuit, comprising: an amplifier having first and second inputs and an output, said first input being coupled for receiving a first input signal, said output providing an output signal; circuit means coupled between a terminal at which a second input signal is applied and said second input of said amplifier for providing a programmable impedance, said circuit means including a plurality of switches to control said programmable impedance; and a compensation circuit coupled to said second input of said amplifier for providing a compensation current that cancels leakage current from said circuit means into said second input of said amplifier and prevents drift in said output signal of said amplifier.