Jump to content

User:KadaneBot/Task2/ReplacementRules

From Wikipedia, the free encyclopedia
  1. Let NAME be the name of the template
  2. Let NUMBER represent the number to be rounded (first parameter)
  3. Let PLACE represent the number of places to round to (second parameter)
  • If NAME is Round and PLACE is undefined and NUMBER has 1 decimal place:
    • Change NAME to Rnd
    • Change PLACE to 1
  • IF NAME is Round and PLACE is undefined and NUMBER has 2 decimal places:
    • Change NAME to Rnd
    • Change PLACE to 2
  • IF NAME is Round and PLACE is undefined and NUMBER has 3 or more decimal places:
    • Change NAME to Rnd
    • Change PLACE to 3
  • IF NAME is Round and PLACE is undefined and NUMBER is a wiki markup expression:
    • Change NAME to Rnd
    • Change PLACE to 3

Note: This can result in a change of appearance, but does not result in loss of precision

  • IF NAME is Round or NAME is Decimals and PLACE is not an integer:
    • Cast Place to an integer and save