VBS tutorial: functions int, fix functions

Time:2021-10-11

Int, fix functions

Returns the integer part of a number.

Int(number)

Fix(number)

numberThe parameter can be any valid numeric expression. IfnumberReturns if the parameter contains nullNull

explain

IntandFixAll functions are deletednumberParameter and returns the result as an integer.

IntandFixThe difference between functions is ifnumberWhen the parameter is negative,IntFunction returns less than or equal tonumberThe first negative integer of, andFixFunction returns greater than or equal tonumberThe first negative integer of the parameter. For example,IntConvert – 8.4 to – 9, andFixThe function converts – 8.4 to – 8.

Fix (number) is equivalent to:

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

The following example illustratesIntandFixHow the function returns the integer part of a number:

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.

Recommended Today

Detailed explanation of Hibernate package function

Hibernate includes a total of 23 jar packages, which is dazzling. This article will explain the role of each jar package of hibernate in detail, so that you can make choices according to your own needs in the application. Download hibernate, such as the stable version of 2.0.3, and decompress it. You can see that […]