export function roundMoneyForDisplay(
  value: number,
  fractionDigits: number = 2,
): number {
  if (!Number.isFinite(value)) {
    return 0;
  }
  const safeDigits = Math.max(0, Math.min(20, Math.floor(fractionDigits)));
  const factor = 10 ** safeDigits;
  return Math.round((value + Number.EPSILON) * factor) / factor;
}
