Python: Converting decimals to imperial fractions
For my blog (the one that you’re currently reading) I wanted to implement an automatic conversion from metric to imperial for all measurements that I mention in my posts. This would help readers from the US to understand them more easily and (probably the more relevant reason) be a nice programming task for me. While I plan to publish the full implementation and write a post about it, this post focuses on a small part of the task: converting decimal values into nice fractions with a denominator that is a power of two. Read more