Name

int — Converts the input number or string into an integer value.

Syntax

int(number)
int(string)
                

The INT function has the following arguments:

number

The double value which you want to convert to an integer value

string

The string value which you want to convert to an integer value

Description

The int function will convert the input value to an integer value.

If the input is a number type then the value is truncated with the fractional digits discarded. Truncation will round positive numbers down to the next lowest integer, and will round negative numbers up to the next higher integer.

If the input is a string value the function will attempt to parse the input as a number. The number will then be converted to an integer as described in the previous paragraph.

If the input is an integer then the value is returned unchanged

Examples

Formula

Description

Result

int(34.66)

Integer value of 34.66

34

int(-17.82)Integer value of -17.82-17
int('6.87')Integer value of '6.87'6