Fuel_usage =
   Trunc((ERnd(Total_ship_mass/10) * Distance * Engine_fuel_usage)
           / (10000 * Max_dist))
                     ...if UseAccurateFuelModel is off
   Total_ship_mass
    * (1.0 - Exp(-(Engine_fuel_usage * Distance) / (Max_dist * 100000)))
                     ...if UseAccurateFuelModel is on

Note that the UseAccurateFuelModel formula can yield fractional values. In case ship movement occurs in multiple phases (because the ship hits a mine), these fractional values are added up, and arithmetically rounded at the end. In contrast, non-accurate movement rounds after every step.

The Engine_fuel_usage is part of the engine definition (engspec.dat), and differs for all engines and speeds. Most reference sheets tabulate Engine_fuel_usage / (Warp^2) because that yields nicer numbers.