# Base Conversion

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

## Recommended Posts

Say i want to convert bases, hex to dec or somthing like that. is there a way to easily convert the digits, or get the number of a certain digit?

##### Share on other sites
Fast Answer: Divide and Modulus by the the Base.

Example: Base 10 to Base 3, the number 748.
(% refers to the Modulus, or Remainder of a number after division)

748 % 3 = 1
748 / 3 = 249
249 % 3 = 0
249 / 3 = 83
83 % 3 = 2
83 / 3 = 27
27 % 3 = 0
27 / 3 = 9
9 % 3 = 0
9 / 3 = 3
3 % 3 = 0
3 / 3 = 1
1 % 3 = 1
1 / 3 = 0

748 in Base 10 is 1000201 in Base 3.

This is just the iterative method, but it works.

##### Share on other sites
I'm closing the thread. Sounds like schoolwork/homework/NOT game-development related, with no justification provided. The Forum FAQ provides details on forum policy.

##### Share on other sites

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

This topic is now closed to further replies.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 22
• 16
• 13
• 14