# Multiplication and division question

This topic is 5054 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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 ?

##### Share on other sites
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)

##### Share on other sites
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

##### Share on other sites
Thanks, aftering reading that I realized what I was thinking. lol.
I forgot that when multiplying integers it's more like using percentages.

##### Share on other sites
If you feel that we helped you in any way, feel free to use the rating system :)

1. 1
2. 2
3. 3
4. 4
Rutin
22
5. 5

• 13
• 19
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
632932
• Total Posts
3009296
• ### Who's Online (See full list)

There are no registered users currently online

×