Rounding Functions
 
 
 

The following functions are useful for performing various rounding calculations.

NoteAlthough you can use these rounding functions as you would any other predefined function, they are actually implemented as user-defined functions in the functions file provided with the Inferno installation. See Defining Your Own Functions.

round

Returns a number rounded to the nearest integer.

Syntax: round(Number)
Arguments:
  • Number is the number to round.
Examples:
  • round(2.8) returns 3.
  • round(-2.8) returns -3.
  • round(2.3) returns 2.

ceil

Rounds a number up to the next integer value regardless of its value.

Syntax: ceil(Number)
Arguments:
  • Number is the number to round up.
Examples:
  • ceil(2.8) returns 3.
  • ceil(-2.8) returns -2.
  • ceil(4) returns 4.

floor

Rounds a number down to the nearest integer regardless of its value.

Syntax: floor(Number)
Arguments:
  • Number is the number to round down.
Examples:
  • floor(2.3) returns 2.
  • floor(-2.3) returns -3.
  • floor(4) returns 4.

trunc

Returns the integer value of a number by truncating its fractional part.

Syntax: trunc(Number)
Arguments:
  • Number is the number that you want to truncate.
Examples:
  • trunc(3.8) returns 3.
  • trunc(-3.8) returns -3.
  • trunc(PI) returns 3.