Tricky Negative Numbers

by Tony Harris - Jenton Software

When trying to extract the integer portion of a number, we immediately think of using the INT function.

However what if the number is negative? When we use the INT function on negative numbers, VB looks for the nearest whole number less than the actual number we are using; e.g. Int(-3.65421) returns -4. This could be a real problem.

Therefore, use the FIX function, which gives the correct answer in both positive and negative cases.

Written by: Tony Harris
Oct 95