The formula with 40 substituted
US gallons = 40 ÷ 3.785411784 = 10.567
The constant is an exact definition, not a rounded factor: the mile is 1.609344 km, the US gallon is 3.785411784 litres and the imperial gallon is 4.54609 litres. The Litres to Gallons Converter explains where each comes from and gives a longer table.
40 litres is 10.567 US gallons and 8.799 imperial gallons. The imperial gallon is 4.54609 litres against the US gallon's 3.785411784, which is why the two answers differ by a fifth.
What 40 litres means in practice
40 litres is 10.567 US gallons or 8.799 imperial gallons, a typical fill for a small car with a 45 litre tank. It is the amount behind most of the fill-to-fill mpg calculations in the manual calculation guide.