PS - Are you testing your sunrise predictions throughout the year? The actual solar day (the time from noon to noon) changes throughout the year. The Mean Solar Day (24 hours) is just the average. The relation between these is something called the Equation of Time. If it were me, I would test at the solstices (two of the four times every year when the equation of time is zero, but also when it changes the most rapidly), and in mid-November and mid-February, when it is largest (about 15 minutes).
Disclaimer: this is just a thought thrown up for consideration. It would have been more helpful if I had consulted the actual code. This is laziness, but not in the Larry Wall sense of the word. Sorry. Tom Wyant PPS - I generally use the U. S. Naval Observatory for the reference value for this sort of thing. It's more "official" than Stellarium, but that's not the same thing as authoritative. - TW