Jeffrey Yasskin wrote: > The second returns the simplest rational within some distance. For > instance, it'll prefer 22/7 over 333/106 if both are close enough. We > might call it .simplest_within() for now. This seems useful for > converting from float and displaying results to users, where we prefer > readability over accuracy or have reason to believe that a simpler > fraction might be more correct. You can use a mediant walk to get to two surrounding fractions w/ some limit, and then return the pair to let the caller choose. See http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52317 for an imperfect implementation.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4