Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems

 

VBScript Fix, Int Functions

Returns the integer portion of a number.

Syntax: VBScript Fix, Int Functions

Int(number)

Fix(number)

Arguments: VBScript Fix, Int Functions

number

Any valid numeric expression. If number contains Null, Null is returned.

Remarks: VBScript Fix, Int Functions

Both Int and Fix remove the fractional part of number and return the resulting integer value.

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

Fix(number) is equivalent to:

Sgn(number) * Int(Abs(number)Int)

The following examples illustrate how the Int and Fix functions return integer portions of numbers:

MyNumber = Int(99.8)    ' Returns 99.

MyNumber = Fix(99.2)    ' Returns 99.

MyNumber = Int(-99.8)   ' Returns -100.

MyNumber = Fix(-99.8)   ' Returns -99.

MyNumber = Int(-99.2)   ' Returns -100.

MyNumber = Fix(-99.2)   ' Returns -99.

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.