Class D airspace was normally 5sm (4.4nm) with extensions for approaches, when they are less than 2nm. If any extension is over 2nm, then the extensions are normally Class E. Many publications claim a 4nm Class D, but searching JO 7400.11A 1, there are many Class D airports with 4.2 or 4.4 or even greater lateral limits.
Some non-FAA publications claim that Class D is 4nm, but few Class D are in fact 4nm, most are larger, and many have extensions. KFDK has a 5nm lateral limit for Class D, and Niagara Falls, KIAG has a 5nm lateral limit with an extension for approach. Reading PA has a 4.2 and 4.8nm lateral limit depending on which side of the airport you are on.
My understanding that that Class D may be influenced by gradients for IFR operations, but also that Class D is frequently a customized airspace.
Furthermore, as an example, Class C airspace, when the radar is OTS (out of service) has the tower revert to Class D. Will that be 4nm or 5sm?
Also, an operating federal control tower does not mean that an airport is Class D. There are airports with towers which lack WX reporting, and are not Class D. One which comes to mind in the past is LCQ, which is now KLCQ.
So where is the definitive set of rules which define Class D?
Where does a pilot obtain the lateral limits of Class D when Class C (or B) is not in place because of radar outage(s)?