Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Guide To CA-Clipper - <b>round()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 ROUND()
 Return a numeric value rounded to a specified number of digits
------------------------------------------------------------------------------
 Syntax

     ROUND(<nNumber>, <nDecimals>) --> nRounded

 Arguments

     <nNumber> is the numeric value to be rounded.

     <nDecimals> defines the number of decimal places to retain.
     Specifying a negative <nDecimals> value rounds whole number digits.

 Returns

     ROUND() returns a numeric value.

 Description

     ROUND() is a numeric function that rounds <nNumber> to the number of
     places specified by <nDecimals>.  Specifying a zero or negative value
     for <nDecimals> allows rounding of whole numbers.  A negative
     <nDecimals> indicates the number of digits to the left of the decimal
     point to round.  Digits between five to nine (inclusive) are rounded up.
     Digits below five are rounded down.

     The display of the return value does not obey the DECIMALS setting
     unless SET FIXED is ON.  With SET FIXED OFF, the display of the return
     value contains as many decimal digits as you specify for <nDecimals>, or
     zero, if <nDecimals> is less than one.

 Examples

     .  These examples round values with decimal digits:

        SET DECIMALS TO 2
        SET FIXED ON
        //
        ? ROUND(10.4, 0)                     // Result: 10.00
        ? ROUND(10.5, 0)                     // Result: 11.00
        ? ROUND(10.51, 0)                    // Result: 11.00
        ? ROUND(10.49999999999999, 2)        // Result: 10.50

     .  These examples use a negative <nDecimals> argument to round
        numeric values to whole number values:

        ? ROUND(101.99, -1)                  // Result: 100.00
        ? ROUND(109.99, -1)                  // Result: 110.00
        ? ROUND(109.99, -2)                  // Result: 100.00

 Files   Library is CLIPPER.LIB.


See Also: SET DECIMALS SET FIXED STR() VAL()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson