Round

4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 3


Round (round; places) Number

ParameterTypeDescription
roundNumberNumber to be rounded
placesNumberNumber of decimal places used for rounding
Function resultNumberNumber rounded to the number of
decimal places specified by Places

Description

Round returns number rounded to the number of decimal places specified by places.

If places is positive, number is rounded to places decimal places. If places is negative, number is rounded on the left of the decimal point.

If the digit following places is 5 though 9, Round rounds toward positive infinity for a positive number, and toward negative infinity for a negative number. If the digit following places is 0 through 4, Round rounds toward zero.

Example

The following example illustrates how Round works with different arguments. Each line assigns a number to the vlResult variable. The comments describe the results:

   vlResult:=Round (16.857; 2)  ` vlResult gets 16.86 
   vlResult:=Round (32345.67; –3)  ` vlResult gets 32000 
   vlResult:=Round (29.8725; 3)  ` vlResult gets 29.873 
   vlResult:=Round (–1.5; 0)  ` vlResult gets –2

See Also

Trunc.


4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next