def undo_squash_to_unit_interval(x: float, constant: float) -> float:
  """Computes the input value of squash_to_unit_interval given the output."""
  if constant <= 0:
    raise ValueError('Squash constant must be greater than zero.')
  if 0 > x >= 1:
    raise ValueError('Undo squash can only be performed on a value in [0, 1).')
  return (x * constant) / (1 - x)