Jump to content

Template:Isotopes/main/format-percent/doc

From Wikipedia, the free encyclopedia

Usage

[edit]
calls: {{Isotopes/main/format-percent/format-number}}
  • The template returns a <blank> when the expected pattern is not found
1. remove prefix-[<≪]*
2. remove any suffix-% (NB suffix "%" is not required; % assumed anyway
3. check remaining value as number (bounce {{BaseConvert{{!}}10to10{{!}}number}})
4. WHEN not a number: return BLANK
5. rounds the number to 3 sigfig
6. dm: when n<0.01%, add prefix "<", when <0.001 add prefix "≪"
7. add suffix "%"
8. return
pattern: (<<≪)123.456( %) or (<≪)10e+6(%)
Other prefixes are not recognied (not "~", "ca.", ..); will return blank
FOR blank return, consider showing raw input:
{{if empty |1={{Isotopes/main/format-percent|raw-perc={{{raw-input|}}} }} |2={{{raw-input|}}} }}
{{Isotopes/main/format-percent
|raw-perc =
|type     =na, dm
}}