Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 231263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:55:05+00:00 2026-05-11T19:55:05+00:00

The main question: How many digits? Let me explain. I have a number in

  • 0

The main question: How many digits?

Let me explain. I have a number in binary system: 11000000 and in decimal is 192.

After converting to decimal, how many digits it will have (in dicimal)? In my example, it’s 3 digits. But, it isn’t a problem. I’ve searched over internet and found one algorithm for integral part and one for fractional part. I’m not quite understand them, but (I think) they works.

When converting from binary to octal, it’s more easy: each 3 bits give you 1 digit in octal. Same for hex: each 4 bits = 1 hex digit.

But, I’m very curious, what to do, if I have a number in P numeral system and want to convert it to the Q numeral system? I know how to do it (I think, I know :)), but, 1st of all, I want to know how many digits in Q system it will take (u no, I must preallocate space).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:55:06+00:00Added an answer on May 11, 2026 at 7:55 pm

    There was an error in my previous answer: look at the comment by Ben Schwehn.
    Sorry for the confusion, I found and explain the error I made in my previous answer below.

    Please use the answer provided by Paul Tomblin. (rewritten to use P, Q and n)

    Y = ln(P^n) / ln(Q)
    Y = n * ln(P) / ln(Q)
    

    So Y (rounded up) is the number of characters you need in system Q to express the highest number you can encode in n characters in system P.

    I have no answer (that wouldn’t convert the number already and take up that many space in a temporary variable) to get the bare minimum for a given number 1000(bin) = 8(dec) while you would reserve 2 decimal positions using this formula.

    If a temporary memory usage isn’t a problem, you might cheat and use (Python):

    len(str(int(otherBaseStr,P)))
    

    This will give you the number of decimals needed to convert a number in base P, cast as a string (otherBaseStr), into decimals.


    Old WRONG answer:

    If you have a number in P numeral system of length n
    Then you can calculate the highest number that is possible in n characters:

    P^(n-1)
    

    To express this highest number in number system Q you need to use logarithms (because they are the inverse to exponentiation):

    log((P^(n-1))/log(Q)
    (n-1)*log(P) / log(Q)
    

    For example
    11000000 in binary is 8 characters.
    To get it in Decimal you would need:

    (8-1)*log(2) / log(10) = 2.1 digits (round up to 3)
    

    Reason it was wrong:

    The highest number that is possible in n characters is

    (P^n) - 1
    

    not

    P^(n-1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is bit specific for Joomla. I have a main menu consisting of:
My main question is how to copy a whole database having a English collation
I have sort of a philosophical question, which also need to consider the performance
This question has been brought up many times, but I'd like to ask it
Ok I have a question and it is probably very easy but I can
The main web application of my company is crying out for a nifty set
My main JavaScript framework is jQuery , so I would like my unit test
function main() { Hello(); } function Hello() { // How do you find out
The main user-case is: Create the 2D floor plan See the 3D view of
Why main must be declared as if it has external linkage? Why it should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.