Monday, August 30, 2010

Visual Basic Math Function : Fix

Purpose : The Fix function truncates the fractional part of a numeric expression and returns the rest as an integer.

Syntax :
Fix ( dblExpression )

dblExpression : Numeric expression of which you want to return the value with the fractional part truncated

Dim dblNumber as Double
Dim intResult as Integer
dblNumber = 54.72
intResult = Fix ( dblNumber )

intResult have value is 54

Value Fix ( Value )
2.7 2
2.2 2
2 2
-2 -2
-2.2 -2
-2.7 -2

No comments:

Post a Comment