< Futurebasic < Language < Reference

Syntax

USR ROUND

USR ROUNDUP

USR ROUNDDOWN

Description

ROUND

Rounds the specified numericExpression to a whole number using the rounding rule (where .5 and higher are rounded up and lower values are rounded down).

ROUNDUP

Rounds the specified numericExpression to the next whole number.

ROUNDDOWN

Rounds the specified numericExpression down to the nearest whole number. This is the same as FIX Example: DIM i#

FOR i = 1 TO 2 STEP 0.1

 PRINT i#,USR ROUNDDOWN(i#),USR ROUND(i#),USR ROUNDUP(i#)

NEXT output:

 1111
 1.1112
 1.2112
 1.3112
 1.4112
 1.5122
 1.6122
 1.7122
 1.8122
 1.9122

See Also

ABS; FIX; FRAC; INT

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.