Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - trunc() return the whole part of a number http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 trunc()             Return the whole part of a number
------------------------------------------------------------------------------
 Declaration
   math.hdr

 Syntax
   func dbl trunc extern
   param value dbl eNumber

 Arguments
   eNumber is a numeric expression.

 Return
   The whole part of the passed numeric.

 Description
   The trunc() function returns the whole part of eNumber. For positive
   numbers, the next lowest integer is returned; for negative numbers, the
   next positive integer is returned.

 Example
   #define EXAMPLE_MATH
   #include example.hdr

   proc Test_trunc
   // Use trunc() to round dollar amounts to the cent
   ? trunc( 2563.32 * 100 ) / 100    // rounded to the cent
   
   ? trunc( 344.99 )
   ? trunc( 1 )
   ? trunc( 56.50 )
   ? trunc( 54.45 )
   ? trunc( 60.019 )
   ? trunc( 60.01 )
   endproc

   proc main
   Test_trunc()
   endproc

See Also: fraction() itrunc() round()

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