Multiplication and division question

Started by
4 comments, last by Nice Coder 19 years, 4 months ago
If some known division problems can be converted into a number that can be used to multiply to get the same answer like (number / 2) is the same as (number * 0.5). Is there a math calucation to determin what number should be multiplied from a division number ?
Advertisement
Number * (1/X) where X is the divisor in your original code (number/X).

Just precalc the 1/X part. (1/2 = 0.5 for instance)
A * (1 / D)

Where you would normally go 1/d

You can precalculate 1/d, or let your compiler do that for you. (assuming an optimising compiler).

The reson why this works?
Fractions,

A = A/1 (fractional)

Fractional division = reciprical & fractional multiplication

You calculate the recipcial by doing 1/d, you then do the fractional multiplication by doing the *. (this works because they all have the same demoninator, 1)

From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
Thanks, aftering reading that I realized what I was thinking. lol.
I forgot that when multiplying integers it's more like using percentages.
If you feel that we helped you in any way, feel free to use the rating system :)
yes, please do.
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.

This topic is closed to new replies.

Advertisement