Return a float value rounded off to an integer


fround(Float:value, method=floatround_round)

Round the value to an integer, using the method given by method.


value Floating point value to be rounded
method Rounding method, default to nearest integer

method is one of:

floatround_round Round to nearest integer. 0.5 rounds up.
floatround_floor Round down to next lower integer
floatround_ceil Round up to next higher integer
floatround_tozero Round towards zero

Return value

Returns the rounded result as an integer

Example usage

   new x;
   x = fround(3.14);                   // 3
   x = fround(3.14, floatround_ceil);  // 4
  • ezeio2/scriptref/fround.txt
  • Last modified: 2019-11-18 23:01
  • by andreh