» Home » VB Fibre
Site
News
Files

Visual Basic
Strings
Math
General
Properties
Memory
Methods

Search
Testing

Inline ASM-VB
Strings
Math
General
Memory

Search
Using inline ASM
Submit!

Division vs multiplication

You can use a multiplication to get the same result as a division. It seems though that the normal devision is way faster than the multiplication method...

Note (30/04/2002): Multiplication is faster when done right. Check out the updated version in this category.

Code:
Public Sub TestOne() Dim lngReturn As Long Dim Action As Long Action = 0.25 '//Becomes 0, my mistake lngReturn = 10 * Action End Sub Public Sub TestTwo() Dim lngReturn As Long Dim Action As Long Action = 4 lngReturn = 10 Action End Sub

Multiply % faster than Division Multiply (sec) Division (sec)
385,6% 0,034819 0,007171
409,2% 0,035744 0,007019
351% 0,032295 0,007161
352,1% 0,032307 0,007146
367,5% 0,032863 0,007029


User contributed notes:

Author: Brian (lpppppl at hotmail dot com) Date: 07:09 03/09/2005
I think you should do one for *0.5 versus \2, which returns the same thing

Add user-note
Author:
E-mail (optional):
Anti spam, please enter 'ok' without quotes:
Comment: