Difference between revisions of "Round"
Line 21: | Line 21: | ||
:Round(-1.5) → 2 | :Round(-1.5) → 2 | ||
− | :Round(Pi,3) → 3. | + | :Round(Pi,3) → 3.14200 |
:Round(12345.6,-2) → 12300.0 | :Round(12345.6,-2) → 12300.0 | ||
Revision as of 21:46, 7 March 2008
Rounds to the nearest integer.
Round(X)
In Analytica 4.1, to round to a given number of digits, i.e,. to the nearest power of 10-digits, use:
Round(X,digits)
Round(X,digits) cannot guarantee that the result can be represented exactly as a power of 10. Analytica represents numbers using a binary floating point format. Fractions that are an exact power of 10-1 cannot always be represented exactly in binary -- i.e., they are usually not an exact power of 1/2. Therefore, non-zeros may be observed around the 16th significant digit. The number returned is a number that is as close to the rounded value as can be represented in an IEEE floating-point binary format. Rounded values generally will display as expected in result tables unless you have the number format set to show more than 15 significant digits.
Library
Math
Examples
- Round(1.4) → 1
- Round(1.5) → 2
- Round(-1.5) → 2
- Round(Pi,3) → 3.14200
- Round(12345.6,-2) → 12300.0
Enable comment auto-refresher