Bookshelf Home | Contents | Index | PDF |
Siebel eScript Language Reference > Methods Reference > Mathematical Methods > Round Number MethodThe Round Number method does the following:
It rounds a positive number or a negative number to the nearest integer. It returns the integer that is closest in value to the value that the number argument contains. This method uses the same argument as the Get Absolute Value method. For more information, see Table 106. FormatExampleThe following example uses the Round Number method: var a = Math.round(123.6); This example provides the following results: Avoiding Precision Loss Due to RoundingThe following example illustrates precision loss due to rounding: var n = 34.855; The value of the n variable is 3485.499999999999995 instead of 3485.5. Rounding this value results in a value of 3485 instead of 3486. The following example avoids loss of precision due to rounding: var n = parseFloat(34.855); If you multiply or divide a value, and then round that value, then rounding might not be precise. Multiplication and division can cause precision loss. |
Siebel eScript Language Reference | Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |