•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-FileROUND(x[,n])

x: aexp
n: iexp

The function ROUND(x) returns x rounded to the nearest whole number. The
variant ROUND(x,n) rounds the expression x to n decimal places. If n is zero,
the effect is the same as for ROUND(x). If n is negative, the rounding is done
before the decimal point, so ROUND(155,-1) results in the number 160,
(Note: CINT() also rounds with an Integer result.)

Examples:

    y=ROUND(-1.2)
    PRINT y,ROUND(1.7)

--> Displays -1 and 2 on the screen.

    FOR i%=-5 TO 5
      PRINT i%,ROUND(PI*100,i%)
    NEXT i%

--> Displays the loop variable and the associated formatted expression on the
    screen: PI is multiplied by 100 and then displayed rounded to i% decimal
    places. Where i% is negative, the rounding is done to the left of the
    decimal point.