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

  const tax = gross * (rate / 100);
  const priceBeforeTax = gross - tax;

  return Math.floor(priceBeforeTax);
}
```