C5_ROUND

 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()

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.