Appr
Appr
Appr[ expr, n ] rounds an expression to a number of decimals.
Appr is not a rounding function for use in scripts, but a function that represents the student task of rounding to a specific number of decimals. Depending on the selected parameters of this operation, it will return a rounded value or a range. If you select a number of decimals as a parameter, this function returns a rounded value. If you do not specify the number of decimals, this function returns a range representing the minimum accuracy for the student's input.
If you want to round a value to a number of decimals in the script, consider using the Numerical function.
If you want to round a value to an integer in the script, consider using the Round function.
Appr[ expr, n ]
Appr[ expr, n ] rounds expr to n decimals. The function will append zeros to the expression as needed to achieve the specified number of decimals.
| Example | in | rendered | reduced |
|---|---|---|---|
π rounded to two decimals. |
Appr[ pi , 2 ] |
π |
3.14 |
3.1 rounded to two decimals. |
Appr[ 3.1, 2 ] |
3.10 |
3.1 |
Appr[ expr, n, RoundingMode=>'exact' ]
Appr[ expr, n, RoundingMode=>'exact' ] rounds expr to n decimals. This usage only accepts the exact number of n decimals as input from the student.
| Example | in | rendered | reduced |
|---|---|---|---|
π rounded to exactly two decimals. |
Appr[ pi, 2, RoundingMode=>'exact' ] |
π |
3.14 |
Appr[ expr ]
| Example | in | rendered | reduced |
|---|---|---|---|
π with the default maximum number of supported decimals. |
Appr[ pi ] |
π |
3.1415926536 |
RoundingMode
RoundingMode can be set to 'exact' to require student input to have the exact number of decimals specified.
| Syntax | Example |
|---|---|
Appr[ expr, n, RoundingMode=>'exact' ] |
Appr[ pi, 2, RoundingMode=>'exact' ] |