Most computers offer two fuel consumption figures, average and instantaneous.
The instantaneous figure is calculated every 2 seconds or so using the odometer and the fuel gauge (or, more likely, the amount of fuel the injectors have been instructed to pump into the engine).
The average fuel consumption is calculated from the distance travelled since you last reset the computer and the fuel used since then.
The computer also keeps a record of the average fuel consumption it has calculated over the last 20 miles or so and uses this to estimated distance your car can travel on the fuel remaining in the tank. This can lead to the interesting situation where, if you've been driving in town with poor fuel consumption and then get into a clear driving situation, your estimated distance left can increase.