ROUND() Function - Round Number

Syntax

ROUND(expr{,int}{,ERR=lineref})

Description

The ROUND() function rounds a number to a specified number of decimal places or to the current precision value.

Parameter

Description

expr

Number to be rounded.

int

Number of decimal places. If this parameter is not included, the number will be rounded according to the current precision level.

ERR=lineref

Branch to be taken if an error occurs during execution.

Examples

Example 1

The following rounds the value to the current precision value:

0010 LET A=ROUND(11.2344521)
0020 PRINT "A=",A

Example 2

The following rounds the value to four decimal places:

0010 LET NUMB=234.9438573498573
0020 LET B=ROUND(NUMB,4)
0030 PRECISION 4
0040 PRINT "B=",B

Example 3

The following rounds a calculation to two decimal places:

0010 LET RATE=4.25; LET HOURS=79.234
0020 LET PAY=ROUND(RATE*HOURS,2)
0030 PRINT "Pay=",PAY
0040 END

See Also

Functions - Alphabetical Listing