How do onboard MPG computers work? Are they accurate?

My new (Dodge) truck has a digital display that shows average miles per gallon and also the number of miles I have left until my tank is empty.

What kind of sensor does this use to determine fuel consumption? Is it based on the float in the gas tank, or is there some kind of flow metering device in the fuel line?

Also, would the reading be affected by the angle of the truck going up/down hills, etc.?

I’d appreciate hearing from anyone who knows The Straight Dope on these things.

The computer knows how many times per second the injectors fire, and for how long. Coupled with the fuel system pressure, the engine computer knows how many milliliters of gas you consume on a pretty much instantaneous basis. So it can pretty accurately predict the current MPG. Giving you accumulated fuel economy is just an adding and averaging game. It’s also pretty accurate. The float in the gas tank knows the fuel level by providing a signal to the computer. So based on your current consumption and some intelligent rounding it can tell you how many miles you have left on the tank. This can be less accurate.

My 2000 Bonneville was just about perfect after it got to know me. My 2001 Continental always says between 430 and 470 miles after a fillup, but I really only get 350 miles or so. Really, though, it’s only innacurate at fillup. During operation it continually adjusts itself so that by the time it says 0 Mile Remaining I genuinely worry about it (happened once, but I made it to the gas station).

Hills and short term variations shouldn’t make a difference. Again because it’s all a computer and different for my GM and Ford and your Daimler there are different programming methodologies. But they should do the sampling on an infrequent enough basis that it won’t make your display all crazy.