Topic: Results
Online Help
Rounding
Rounding is specified by the number of digits k after the decimal point. It is entered into the "Rounding" input box at the bottom of the program window. The value of k can be between "0" and "15". If you enter "0", all results will be rounded to integers. If the value is less than "0" or greater than "15", the respective limit will be taken.
However, rounding can come across some potential problems. If the result is less than 10-k and you round it to k digits after the decimal point, the result will contain only zeros. That is why, Calcpad incorporates some advanced rules: If the output contains less than k significant digits after rounding, it is expanded up to k significant digits. Even then, if the number is too small, it will be difficult to count the zeros after the decimal point. So, in such cases, the output is converted to floating point format with k digits. When the total number of digits becomes greater than 2k, the factional part is being truncated. In this way, the output becomes easier to read, still providing at least 2k significant digits. You can see several examples bellow, obtained for (k = 3).
- 0.000001∙π = 3.14E-06
- 0.001∙π = 0.00314
- 0.1∙π = 0.314
- 1∙π = 3.142
- 1000∙π = 3141.59
- 1000000∙π = 3141593
Rounding affects only the way in which numbers are displayed in the output. Internally, all numbers are stored with the maximum possible precision. That is why, if you print the output and try to repeat the calculations with the numbers from the report, you probably will get some little differences. This is because you use the rounded values instead of the actual ones.
Table of contents
-
+
About Calcpad
-
+
Writing code
-
+
Coding aids
-
+
Expressions
-
+
Reporting
-
+
Programming
-
−
Results
-
+
Working with files