Skip to main content

floatround

warning

This function starts with a lowercase letter.

Description

Round a floating point number to an integer value.

NameDescription
Float:valueThe value to round.
floatround_method:methodThe floatround mode to use.
By default: floatround_round

Returns

The rounded value as an integer.

Examples

new value = floatround(3.3, floatround_ceil);
printf("3.3 rounded to %d", value); // 3.3 rounded to 4

new value = floatround(50.996229);
printf("50.996229 rounded to %d", value); // 50.996229 rounded to 51

new value = floatround(270.0034);
printf("270.0034 rounded to %d", value); // 270.0034 rounded to 270
  • float: Convert an integer to a float.
  • floatstr: Convert an string to a float.