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 - iround() round a number to integer http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 iround()            Round a number to integer
------------------------------------------------------------------------------
 Declaration
   math.hdr

 Syntax
   func long iround extern
   param value dbl eNumber

 Arguments
   eNumber is the number to convert.

 Return
   The rounded value of the passed numeric.

 Description
   The iround() function rounds argument to an integer and returns the
   integer as type long. This is the same as:

   itrunc( eNumber + 0.5 )

   By using the iround() function loss of precision warning messages
   by the compiler can be avoided.

 Example
   #define EXAMPLE_MATH
   #include example.hdr

   proc Test_iround
   ? iround( -10.4 )      // prints -10
   ? iround( -10.5 )      // prints -11
   ? iround(  10.4 )      // prints  10
   ? iround(  10.5 )      // prints  11
   endproc

   proc main
   Test_iround()
   endproc

See Also: itrunc() round()

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