VBScript Fix Function

Definition and Usage

The Fix function can return the integer part of a specified number.

Note:If the number parameter contains Null, it returns Null.

Tip:See Int function. Both the Int and Fix functions remove the decimal part of the number parameter and return the result expressed as an integer.

The difference between the Int and Fix functions is that if the number parameter is negative, the Int function returns the first negative integer less than or equal to number, while the Fix function returns the first negative integer greater than or equal to the number parameter. For example, Int converts -8.4 to -9, while the Fix function converts -8.4 to -8.

Syntax

Int(number)
Parameter Description
number Required. A valid numeric expression.

Instance

Example 1

document.write(Fix(6.83227))

Output:

6

Example 2

document.write(Fix(6.23443))

Output:

6

Example 3

document.write(Fix(-6.13443))

Output:

-6

Example 4

document.write(Fix(-6.93443))

Output:

-6