Round: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(Created page with "ROUND(''number''[, ''fractionaldigits'']) '''Description''' ROUND returns a number that has been rounded to the specified number of decimal places. The required argument, ''...")
 
No edit summary
Line 1: Line 1:
ROUND(''number''[, ''fractionaldigits''])
Round(''number''[, ''fractionaldigits''])


'''Description'''
== Description ==


ROUND returns a number that has been rounded to the specified number of decimal places. The required argument, ''number'', is any valid numeric expression. The optional argument, ''fractionaldigits'', is the number of decimal places included in the rounding; if ''fractionaldigits'' is not provided it defaults to 0 and ROUND returns integers.
Round returns a number that has been rounded to the specified number of decimal places. The required argument, ''number'', is any valid numeric expression. The optional argument, ''fractionaldigits'', is the number of decimal places included in the rounding; if ''fractionaldigits'' is not provided it defaults to 0 and ROUND returns integers.


'''Example'''
== Example ==


<pre>
<pre>
REM ROUND Example
Rem Round Example
'ROUNDroundsnumberstoagivendecimalplace
'Round rounds numbers to a given decimal place
DIM Pi, Pure, Ate
Dim Pi, Pure, Ate
Pi = ROUND(3.14159265, 4)
Pi = ROUND(3.14159265, 4)
PRINT Pi
Print Pi
Pure = ROUND(99.4444, 2)
Pure = Round(99.4444, 2)
PRINT Pure
Print Pure
Ate = ROUND(SQR(69))
Ate = Round(Sqr(69))
PRINT Ate
Print Ate
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 27: Line 27:
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[int|INT]], [[fix|FIX]]
[[int|INT]], [[fix|FIX]]
[[Category:Language Reference]]

Revision as of 03:01, 17 August 2012

Round(number[, fractionaldigits])

Description

Round returns a number that has been rounded to the specified number of decimal places. The required argument, number, is any valid numeric expression. The optional argument, fractionaldigits, is the number of decimal places included in the rounding; if fractionaldigits is not provided it defaults to 0 and ROUND returns integers.

Example

Rem Round Example
'Round rounds numbers to a given decimal place
Dim Pi, Pure, Ate
Pi = ROUND(3.14159265, 4)
Print Pi
Pure = Round(99.4444, 2)
Print Pure
Ate = Round(Sqr(69))
Print Ate

Output

3.1416
99.44
8

Related Items

INT, FIX