Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> round round to nearest integer pp 142</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 ROUND                    Round to Nearest Integer                    pp 142

 Syntax:  Round (RealVar) ;

 Type:    Integer

 Form:    Function

 Purpose: Round RealVar to the nearest integer.

 Notes:   If RealVar >= 0 then Round (RealVar) = Trunc (RealVar + 0.5).
          If RealVar <  0 then Round (RealVar) = Trunc (RealVar - 0.5).


 ----------------------------------------------------------------------------


 Usage:
       CONST
          Real1  : Real =  2.5    ;  { IntVar =  3 after Round }
          Real2  : Real =  0.5    ;  { IntVar =  1 after Round }
          Real3  : Real = -3.4    ;  { IntVar = -3 after Round }
          Real4  : Real = -0.6    ;  { IntVar = -1 after Round }

See Also: Int Trunc

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson