|
Division Mini Tutorial
Are you dividing properly?If your formulas are returning unexpected results, you may not be using the correct division sign. This mini tutorial will explain when to use either of the two division signs. The / divisionWhen you use the / sign to divide, the result will be a Double floating-point. Here is an example: Dim MyDivide As Double ' MyDivide will be 6.25 Now, as with most rules, there are exceptions:
The \ divisionWhen you use the \ sign to divide, the result will be an Integer. Before division is performed, the numeric expressions are rounded to Byte, Integer, or Long expressions. Here is an example: Dim MyDivide As Double As you can see, if you did not use the proper Division sign, you would get invalid results, even though you declared MyDivide as a double. So remember, this easy to fall into, Gotcha. K&K Consulting's VB Guru, June 2000
|
Send mail to WebMaster with
questions or comments about this web site.
|