Int

(Use for rounding by adding 0.5)

(Engine-Level Function)

Description: Integer Portion of Number. This function returns the portion of a number before the decimal point. Also used for rounding.
Returns: Integer
Usage: Script or steady state.
Function Groups: Rounding Math
Related to: Ceil |Step
Format: Int(X)
Parameters:  
X   
Required. Any numeric expression. Normally this is a floating point value.

Comments:

The Int function is sometimes referred to as "floor."

To round a number instead of truncating it, add 0.5 to each value.

Examples:

  a = Int(1.00);
  b = Int(1.12);
  c = Int(1.99);
  d = Int(2.00);
  e = Int(-1.00);
  f = Int(-1.9);

 The variables a, b, c, d, e and f will have values of 1, 1, 1, 2, -1 and -2 respectively.

  x1 = 3.4;
  y1 = 4.7;
  x2 = Int(x1 + 0.5);
  y2 = Int(y1 + 0.5);

The value of x2 and y2 in the above example will be 3 and 5 respectively. Notice how adding 0.5 to each value causes the Int function to perform mathematical rounding (of the original value, not the sum) rather than truncation.