Help! I invented an algorithm and I don’t know how it works!

This past weekend, I needed to find a good fraction to approximate a given value. Along the way, I learned about continued fractions, and emerged with a neat, efficient algorithm. The only trouble is, I can’t figure out why it …