Wikipedia has a precise AWG formula:
http://en.wikipedia.org/wiki/American_wire_gauge
Unfortunately, it's arranged to convert AWG number to diameter. The
original poster asked for the opposite conversion. Rearranging the
Wikipedia formula to run that way gives:
39 × log (200 × d)
AWG = 36 - --------------------
log 92
where d = diameter in inches.
The equation looks gnarly, but it's mostly constants and can
be simplified to this approximation:
AWG = -9.7 - 19.86 × log d
That's accurate within ±.01 AWG, from 0000 to 50 gauge.