Given a high precision real number, how should I go about guessing an algebraic integer that it's close to?

Of course, this is extremely poorly defined -- every real number is close to a rational number, of course! But I'd like to keep both the coefficients and the degree relatively small. Obviously we can make tradeoffs between how much we dislike large coefficents and how much we dislike large degrees.

But that aside, I don't even know how you'd start. Any ideas?

**Background**: this comes out of the project that prompted Noah's recent question on solving large systems of quadratics. We're trying to find subfactors inside their graph planar algebras. We've found that solving quadratics numerically, approximating the solutions by algebraic integers, and then checking that these are actually exact solutions is very effective. So far, we've been making use of Mathematica's "RootApproximant" function which does exactly what I ask here, but it's an impenetrable black box, like everything out of Wolfram.

numberof smallish height close to the given number, not an algebraicinteger. $\endgroup$ – Kevin Buzzard Feb 19 '10 at 20:29