This article is from the Photographic Lenses FAQ, by David Jacobson with numerous contributions by others.
Sclose = h * So / (h + (So - f)) Sfar = h * So / (h - (So - f))
or, we can define a "hyperfocal ratio", hr = h/(So - f), or roughly the ratio of the hyperfocal distance to the object distance. Then
Sclose = So * hr/(hr+1) Sfar = So * hr/(hr-1)
These formulas are also correct when hr is defined as hr = h/So and the N used in computing h is actually Ne.
If the denominator is zero or negative, Sfar is infinity.