// Numbas version: exam_results_page_options {"name": "Rounding: to a given number of significant figures", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Rounding: to a given number of significant figures", "tags": ["rounding"], "metadata": {"description": "

Round numbers to a given number of significant figures.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "

The first thing to do when we are rounding numbers is to identify the last digit we are keeping.

\n

When you're asked to round your answer to a number of significant figures, you need to decide whether to keep the last digit same (rounding down) or increase it by 1 (rounding up). If the following digit is less than 5 we round down and we round up when the next digit is 5 or more.

\n

To write it down in steps:

\n
    \n
      \n
        \n
          \n
        1. Identify the last digit we need to keep.
        2. \n
        3. Look at the following digit.
        4. \n
        5. If it's 5 or more, increase the previous digit by one.
        6. \n
        7. If it's 4 or less, keep the previous digit the same.
        8. \n
        9. Fill any spaces to the right of the digit with zeros if needed.
        10. \n
        \n
      \n
    \n
\n

It is important to keep in mind that if the digit we are increasing is 9, it becomes zero and we increase the previous digit instead. If this digit is 9 as well, we move along to the left side until we find a digit less than 9.

\n

The last digit we need to keep will depend on how many zeros there are.  We don't consider leading zeros to be significant,
i.e. 0.03 and 0.3 both have 1 significant figure (but 0.30 has two significant figures, since the second zero isn't a 'leading' zero).

\n

a)

\n

i)

\n

We round $\\var{d1}$ to 1 significant figure. The first non-zero digit is $\\var{ddig[5]}$. The following digit is $\\var{ddig[4]}$ so we round updown to get $\\var{dpformat(siground(d1, 1), 0)}$.

\n

ii)

\n

We round $\\var{d1}$ to {sf} significant figures. The first non-zero digit is $\\var{ddig[5]}$. The second following digit is $\\var{ddig[4]}$, the third following digit is $\\var{ddig[3]}$ and the fourth following digit is $\\var{ddig[2]}$. The digit following the last digit we are keeping is  $\\var{ddig[3]}$$\\var{ddig[2]}$$\\var{ddig[1]}$, so we round to get $\\var{sigformat(d1, sf)}$. These are our {sf} significant figures. 

\n

\n

b)

\n

i)

\n

We round $\\var{e1}$ to 1 significant figure. The first non-zero digit is $\\var{edig[4]}$, followed by $\\var{edig[3]}$. This is lower than 5 so we round downmore than 5 so we round up to get $\\var{sigformat(e1,1)}$.

\n

ii)

\n

We round $\\var{e1}$ to {sf} significant figures. The first non-zero digit is $\\var{edig[4]}$. The second following digit is $\\var{edig[3]}$, the third following digit is $\\var{edig[2]}$ and the fourth following digit is $\\var{edig[1]}$. The digit following the last digit we are keeping is $\\var{edig[2]}$$\\var{edig[1]}$$\\var{edig[0]}$, so we round to get $\\var{sigformat(e1, sf)}$. These are our {sf} significant figures. 

\n

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"edig": {"name": "edig", "group": "Ungrouped variables", "definition": "repeat(random(1..9), 5)", "description": "", "templateType": "anything", "can_override": false}, "d1": {"name": "d1", "group": "Ungrouped variables", "definition": "n_from_digits(ddig)", "description": "

Random integer.

", "templateType": "anything", "can_override": false}, "e1": {"name": "e1", "group": "Ungrouped variables", "definition": "n_from_digits(edig)*10^(random(-6,-7,-8))", "description": "

Random number with 7 decimal places.

", "templateType": "anything", "can_override": false}, "ddig": {"name": "ddig", "group": "Ungrouped variables", "definition": "repeat(random(1..9), 6)", "description": "", "templateType": "anything", "can_override": false}, "sf": {"name": "sf", "group": "Ungrouped variables", "definition": "3", "description": "

Number of significant figures to round.

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": "100"}, "ungrouped_variables": ["sf", "ddig", "edig", "d1", "e1"], "variable_groups": [], "functions": {"n_from_digits": {"parameters": [["digits", "list"]], "type": "number", "language": "jme", "definition": "if(\n len(digits)=0,\n 0,\n digits[0]+10*n_from_digits(digits[1..len(digits)])\n)"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Round $\\var{d1}$ 

\n

i) $\\var{d1}$ rounded to 1 significant figure is:  [[0]]

\n

ii) $\\var{d1}$ rounded to {sf} significant figures is:  [[1]]

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "precround(siground(d1, 1),0)", "maxValue": "precround(siground(d1, 1),0)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "siground(d1, sf)", "maxValue": "siground(d1, sf)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Round $\\var{e1}$

\n

iii) $\\var{e1}$ rounded to 1 significant figure is:  [[0]]

\n

iv) $\\var{e1}$ rounded to {sf} significant figures is:  [[1]]

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "siground(e1, 1)", "maxValue": "siground(e1, 1)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "siground(e1, sf)", "maxValue": "siground(e1, sf)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}, {"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Stanislav Duris", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1590/"}, {"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}]}