Microsoft Office 2000/Visual Basic Programmer's
Guide |
|
Mathematical Operations
The following points provide suggestions for ways to speed up operations on numbers:
-
When performing division on integers, use the integer division operator (\) rather than the floating-point division operator (/), which always returns a value of type Double regardless of the types of the numbers being divided.
-
Keep in mind that any time you use a Single or Double value in an arithmetic expression with integer values, the integers are converted to Single or Double values, and the final result is a Single or Double value. If you're performing several operations on a number that is the result of an arithmetic operation, you may want to explicitly convert the number to a smaller data type.