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> trunc truncate number to integer pp 142</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 TRUNC                    Truncate Number to Integer                  pp 142

 Syntax:  Trunc (NumVar) ;

 Type:    Integer

 Form:    Procedure

 Purpose: Truncate NumVar to integer variable.

 Notes:   Returns the greatest integer less than or equal to NumVar if
          NumVar >= 0, or smallest integer of NumVar < 0.

 Logic:   IntegerResult <= NumVar >= 0   or   IntegerResult >= NumVar <  0


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



 Usage:
       VAR
          IntVar  : Integer          ;
          RealVar : Real             ;

       BEGIN
          Intvar  := Trunc (IntVar)  ;
          IntVar  := Trunc (RealVar) ;
          IntVar  := Trunc (1.456)   ;
       END.

See Also: Int Frac Round

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