```ts
export function vatBack(gross: number, rate: number): number {
  if (rate < 0) {
    throw new Error("Rate cannot be negative");
  }

  const priceBeforeTax = gross / (1 + rate);
  return Math.floor(priceBeforeTax);
}
```