emptymiles
A small Haxe class for the math behind a number every driver argues about: the rate per mile after the empty miles to the pickup are counted.
var trip = new emptymiles.Trip(80, 420, 1260);
trip.quotedRatePerMile(); // 3.0 (what the broker says)
trip.allInRatePerMile(); // 2.52 (what the truck actually earns)
trip.deadheadPercent(); // 16.0
trip.linehaulForTarget(2.8) // 1400 (what the load must pay to clear $2.80 all-in)
Install: haxelib install emptymiles
If you would rather not write code, there is a browser version of the same arithmetic: https://truckleap.com/deadhead-miles-calculator
Written by George Green at TruckLeap. Owners of tractors who pull someone else's trailer run into the same empty-mile question every week; some of the thinking behind that is written up as how a desk keeps tractors loaded when the trailer is not theirs.
MIT licensed.