Floatround

floatround

Description:
Function floatround round a floating point number to an integer value.
This function name starts with a lowercase letter.


Parameters:
(Float:value,method = floatround_round)
float value The value to round.
int method The floatround method to use.


Floatround methods:
  • floatround_round: Round to the nearest integer. A fractional part of exactly 0.5 rounds upwards (this is the default).
  • floatround_floor: Round downwards.
  • floatround_ceil: Round upwards.
  • floatround_tozero: Round downwards for positive values and upwards for negative values (“truncate”).


Return Values:
The rounded value as an integer.


Examples:
floatround(3.3, floatround_ceil);


Related Functions
The following functions may be useful, as they are related to this function in one way or another.
  • float: Converts an integer into a float.
  • floatstr: Converts a string to a float.
  • floatmul: Multiplies two floats with each other.
  • floatdiv: Divide one float by another one.
  • floatadd: Adds two floats together.
  • floatsub: Subtracts one float from another.
  • floatfract: Get the fractional part of a float.
  • floatcmp: Compare float values to each other, to validate the comparison.
  • floatsqroot: Calculates the square root of given value.
  • floatpower: Raises the given value to the power of the exponent.
  • floatlog: Allows you to get the logarithm of a float value.
  • floatsin: Get the sine from a given angle.
  • floatcos: Get the cosine from a given angle.
  • floattan: Get the tangent from a given angle.
  • floatabs: Returns the absolute value of float.