How can an op-amp act as a precision diode?
An ideal op-amp wants to make its two inputs equal in voltage through the negative feedback path. Look at a very simple "precision diode":



Notice that the inverting input (-) is also Vout. Vin is the other input. Remember, the op-amp wants to make its inputs the same voltage.

Let's assume that Vout starts at 0V, and Vin is 5V. Because the inverting input is at a lower voltage than the non-inverting input, the output of the op-amp will be positive. This causes current to flow through the diode, to ground.

If this were just a diode, then we'd observe the usual 0.65-ish volt drop of the diode. But the op-amp still sees this difference. At the point where Vout is 0.65V less than Vin, there is still a difference between the op-amp's inputs, and consequently it will drive the output even higher, seeking equilibrium where the two inputs are the same voltage.

Eventually, the op-amp's output voltage is 0.65V higher than Vin. After the voltage drop, this makes Vout = Vin, and the op-amp's inputs are at the same voltage, and we have reached equilibrium.

Now Vout and Vin are at 5V, but say then Vin drops to 0V. The op-amp will now try to compensate by outputting the most negative voltage it can. However, the diode prevents any current flowing due to this negative voltage. Thus, it behaves as a diode, allowing current in only one direction, except with no voltage drop.