fround

Return a float value rounded off to an integer

Description

fround(Float:value, method=floatround_round)

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

Parameters

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