I happened to read the wonderful book "Pi and the AGM" written by Borwein brothers several months ago, and I wondered how they proved the famous formula $$\frac{1}{\pi}=\frac{2\sqrt{2}}{9801}\cdots$$ After reading their proof, I realized that the theory of special value of modular forms is closely related to your question. [Modular form of level 2](http://en.wikipedia.org/wiki/Ramanujan%E2%80%93Sato_series) $$8\left(\frac{\eta(2\tau)}{\eta({\tau})}\right)^{12}$$ appears in the formula given by Ramanujan. I hear that H. M. Weber computed some special values of this modular form with [Kronecker limit formula](http://en.wikipedia.org/wiki/Kronecker_limit_formula), where some Eisenstein series appears in it. Proper linear combination(which is closely related to the ideal class of some imaginary quadratic field) of Eisenstein series will give logarithmic of the modular form on the RHS, while the linear combination itself is a Hecke L-function which can be decomposed to the product of Dirichlet L-functions. Then the fundamental unit naturally appears in the Dirichlet class number formula. More details can be found in the [book](http://www.math.umn.edu/~garrett/m/mfms/notes_2013-14/Siegel_AdvAnNoTh.pdf) of C.L.Siegel(Chapter II).