Template:Precision/sandbox

<!-- - --NOTES: --     [ These comments are skipped by and will --       not appear in formatted pages, only during edit. ] -- -- NOTE A1: This template checks a numeric expression for a --     fraction denominator "/nnn" and either returns the --     logarithm size of nnn, or else invokes subtemplates --     to determine the count for rounding precision:  so, --     34.560 gives 3, while 3400 gives -2, for rounding --     decimals, or by whole hundreds. -- -- NOTE F2: Fractions are detected when {1}0 < {1}, as cases --     such as 3+2/50 < 3+2/5, based on concept of how any --     denominator gets bigger when appending "0" and thus --     the fraction gets smaller, as in the case 2/50 < 2/5. --     Negatives are checked by absolute value, abs( {1} ), --     so the logic is: abs(0) < abs. -- -- NOTE I3: Integers are detected by {1}0 > {1}, as cases --     such as 4510 > 451, while 45.10 = 45.1 as compared --     in #ifexpr expressions. Integers are processed for --     trailing zeroes as negative precisions, such as --      230 gives -1, 2300 gives -2, or 23000 gives -3. The --     logic is: 0= which is --      false for integer amounts. Integer digits are checked --     by template {Precision/0} & {Precision/00} etc. -- -- NOTE N4: The subtemplates which count decimal digits are --     designed to take raw numerals with trailing zeroes, --     such as 45.0300, and when negative, the decimals are --     reversed by 0-{1} (zero minus the negative amount), --     because absolute value of -45.0300 drops zeroes 45.03; --     hence, only integers are reversed by abs( {1} ). -- -- NOTE P5: The parameter {1} is given various default values --     where results can be checked during edit-preview of --      this template, by changing default values, rather than --     saving multiple edits to check potential changes. So, --     instead, values as such  are set to see --     what results will come from the subtemplates based on --      changing the value of {1}, for each type of number. --     There is almost no need to edit-and-save just to try --     different logic: instead, reset {1} and edit-preview. -- -- NOTE ZZ: Notes here are intended to explain template coding --     where unusual algorithms are being used, or operation --     might seem confusing. Other notes should be added when --     questions arise about the details. These HTML comments --     are omitted via, otherwise formatted pages --     often contain HTML comments unless within. -- -- WARNING: *** DO NOT DELETE COMMENTS FROM THIS TEMPLATE *** --     Unless these comments are readily available, people --     might tinker with the coding (or rename templates), --     in hopes to clarify operation because these comments --     were not nearby to explain the issues. Having these --     comments only on a doc-page increases the danger of --      explanations no longer matching the current coding. --     UPDATE these comments to match changes to the template. --     UPDATE the HISTORY during major changes (not typos). -- -- --HISTORY: --04Apr07 Created by User:Quarl on English Wikipedia. --17Nov10 Merged {Precision/a} text as 1 less in 40-nest limit. --17Nov10 Used #iferror to check {1} for invalid numeric data. --17Nov10 Handled negative integers, as reversed by abs( {1} ). --17Nov10 Handled negative decimals by 0-{1}, zero minus value. --17Nov10 Put NOTES comments to explain template coding. --17Nov10 Put HISTORY comments to log major changes. -- -->