It's well-known that $ e^{\pi \sqrt{d}} $ is almost an integer when $ d $ is taken to be one of the large Heegner numbers $ d = 43, 67, 163 $.
I'm interested to know what the history of this discovery was like. Specifically, did the "empirical discovery" of the almost-integer values of $ e^{\pi \sqrt d} $ come before or after the theory of complex multiplication was already well understood? In other words, was the discovery that $ e^{\pi \sqrt d} $ was almost an integer for some small values of $ d $ accidental or was it motivated by known properties of the $ j $-invariant?