Template:Dec to frac/doc
From Wikibooks, open books for an open world
This is a documentation subpage for Template:Dec to frac (see that page for the template itself). It contains usage information, categories, and other content that are not part of the original template page. 
This template employs intricate features of template syntax.
You are encouraged to familiarize yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly. Remember that you can conduct experiments, and should test all improvements, in either the general template sandbox or your user space before changing anything here.

This template converts decimal fractions to vulgar fractions. It takes two parameters:
 fraction to be converted;
 resulting vulgar fraction's denominator
If the decimal fraction includes an integer part, it is retained in the output. If the resulting vulgar fraction can be resolved in lower terms than specified denominator, it is resolved, but due to algorithm limitation fractions with relatively large numerators/denominators may be left unresolved.
Examples[edit]
 {{dec to frac3.674216}} → 3^{ 11}⁄_{16}
 {{dec to frac0.37516}} → ^{ 3}⁄_{8}
Sometimes it is impossible to convert a decimal to a vulgar fraction with requested denominator, in which cases the output is simply an input rounded up:
 {{dec to frac3.998}} → 4
...or down:
 {{dec to frac3.12}} → 3
When that is unacceptable, increase the denominator:
 {{dec to frac3.99100}} → 3^{ 99}⁄_{100}
 {{dec to frac3.110}} → 3^{ 1}⁄_{10}