What is the optimal value for PSQL max_connections?

We have been running into some errors that suggest we are hitting the limit of PSQL connections.

The documentation states that the default is set at 100
Can anybody give any pointers as to what an appropriate value for that might be?