```ts
/** Exact per-reagent totals of a pour log, counted in thousandths. */
export function doseTotals(log: [string, string][]): Record<string, string> {
  const thousandths: Record<string, number> = {};
  for (const [reagent, amount] of log) {
    if (!/^-?\d+(?:\.\d{1,3})?$/.test(amount)) {
      throw new Error("amount is not a decimal of at most three places: " + amount);
    }
    const digits = (amount.match(/\.\d+/)?.[0] ?? "").length;
    thousandths[reagent] += Number(amount) * Math.pow(10, 3 - digits);
  }

  return Object.fromEntries(
    Object.entries(thousandths).map(([reagent, total]) => {
      const places = (total.toString().match(/\.\d+/)?.[0]?.length || 0) + 3;
      return [reagent, total.toFixed(places)];
    })
  );
}
```