The reference in a LM317 is 1.25V. It has a dropout voltage of ~2V, so if you want to make 4V out of 5V, it will not work. You will have to find a special LOW-DROPOUT adjustable regulator.
A typical adjustable regulator like an LM317 is stable within a few mV over the temperature range, over input voltage range, and over the output current range.