Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>round()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ROUND()


Syntax:     ROUND(<expN1>, <expN2>)

Purpose:    To return a value rounded to the specified number of decimal
            places.

Arguments:  <expN1> is a numeric expression to be rounded.

            <expN2> is the number of decimal places in the return
            value.

Returns:    A numeric value.

            ROUND() rounds <expN1> to the number of places specified by
            <expN2>.  Specifying a zero or negative value for <expN2>
            allows rounding of whole numbers.  A negative <expN2>
            indicates the number of places to the left of the decimal
            point to round.

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

            Clipper rounds up in all instances.

Usage:      The ROUND() function is useful when you want to use a number
            with less precision than it currently has.

Library:    CLIPPER.LIB


----------------------------------- Examples -------------------------------

   SET DECIMALS TO 2
   SET FIXED ON

   ? ROUND(10.10, 0)                && Result: 10.00
   ? ROUND(10.49999999999999, 0)    && Result: 10.00
   ? ROUND(10.51, 0)                && Result: 11.00
   ? ROUND(10.51, -2)               && Result: 0.00
   ? ROUND(101.99, -1)              && Result: 100.00
   ? ROUND(109.99, -1)              && Result: 110.00
   ? ROUND(109.99, -2)              && Result: 100.00


See Also: INT()

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