It's all in GlobalDefines.
Without a courthouse, a city's unhappiness is
UNHAPPINESS_PER_CAPTURED_CITY (5) + UNHAPPINESS_PER_OCCUPIED_POPULATION (1.34) * population
With a courthouse, it drops to the normal
UNHAPPINESS_PER_CITY (3) + UNHAPPINESS_PER_POPULATION (1) * population
So unless you've altered these numbers in a mod, a courthouse reduces unhappiness by 2.0 + 0.34*pop on normal difficulties.
Note that only the 1.34 value is stored as a float; everything else is an integer and won't accept a float value. And notice that I said "on normal difficulties"; if you play on a low difficulty (like chieftain, which the AI plays on by default) all unhappiness is multiplied by your handicap's <NumCitiesUnhappinessMod> and <PopulationUnhappinessMod> variables.
Those of us who've changed the unhappiness-per-population have just altered those modifier values; in my own mod, the population unhappiness is 1.2 for normal citizens and 1.6 for occupied cities. But since the "1" value for per-population unhappiness can't take a float value, you have to do this by altering the handicap modifiers to average a 120 instead of a 100.
So if you're using this information for some sort of UI mod, you NEED to be adjusting for these handicap modifiers, because while they'll be 1.0 for the vanilla game at Prince or higher, they could easily be higher or lower for other people.