hello
how to divide or multiply percentages in masm32 ??
some example code please to learn ??
thanks
i found it and it is simple
1000 * 0.006 = (1000 * 6 )/1000 = 6
MOV EAX, 1000
mov ebx,6
mul ebx
mov ebx,1000
div ebx
thanks
mahmudkais,
If you are going to be doing much number crunching, have a look at Ray Filiatreault's floating point maths library included in the masm32 sdk, simple interger maths have their place but for more complex work the floating point capacity is a lot more powerful.
thanks
i will
If your just doing simple percentages the FPU is a bit of overkill, mostly they can be done using integer math as you posted above. To save a few clock cycles you can get rid of the DIV instruction...
http://blogs.msdn.com/devdev/archive/2005/12/12/502980.aspx
Edgar
There is a tiny tool that does this, Magic Divider. I mean breaks down the divisions to multiplication using a constant. Attached.