4 ms·Best rational approximation 8 points by wglb 16y agobtilly 16y agoBasically this is a binary search on the Stern-Brocot tree. See http://en.wikipedia.org/wiki/Stern%E2%80%93Brocot_tree http://en.wikipedia.org/wiki/Stern%E2%80%93Brocot_tree for more.cperciva 16y agoAlso known as: Invoke the (extended) Euclidean algorithm on 1 and x.