```ts
export function doseTotals(log: [string, string][]): Record<string, string> {
  const totals: Record<string, number> = {};

  for (const [reagent, amount] of log) {
    if (!/^-?\d+(\.\d{1,3})?$/.test(amount)) {
      throw new Error(`Invalid amount format: ${amount}`);
    }

    const millilitres = parseFloat(amount);
    totals[reagent] = (totals[reagent] || 0) + millilitres;
  }

  return Object.fromEntries(
    Object.entries(totals).map(([reagent, total]) => [
      reagent,
      total.toFixed(Math.max(...log.filter(([r]) => r === reagent).map(([_, a]) => (a.includes('.') ? a.split('.')[1].length : 0)))).replace(/\.?0+$/, '')
    ])
  );
}
```