RunningShoes Library for WinRunner
Custom WinRunner Functions
A Random Collection of WinRunner Solutions
Creating DLLs for WinRunner
Calculate the integer portion of ANY input value.
WinRunner's int(x) function is defined to work when x > 0. It returns an incorrect value when x < 0. The Integer() function here works correctly over all x, so it corrects the problem in int(). In addition, the function has built-in protection in case Mercury fixes the error in a future release.
The problem with the int() function is that it apparently rounds the input down, instead of taking the integer portion of the input. That works okay with positive input, but with negative input, it returns the next lower integer.
For example, the integer portion of -5.5 is -5. However, int(-5.5) returns -6, since it rounds down. The function here returns the correct value: Integer(-5.5) returns -5.
The code is in a text file to avoid the display mangling that browsers tend to do to normal pages. View Integer.txt.
Copyright R. E. Cook Consulting, 2000 - 2011.
The site is designed to look best when viewed with Internet Explorer 5.0 - 8.0. Results with other browsers will probably deviate from what is intended.
NOTE: This website refers to registered trademarks and service marks that are owned by other companies, including Mercury Interactive, WinRunner, TestDirector, TSL, Microsoft, Windows.