Representation of a decimal number

radha gogia

radha gogia

@radha-BTDzli Oct 22, 2024
I just wanted to ask that if I have a 25 digit decimal number,so actually if i wanted to calculate the no .of bits to represent that number ,then we follow the approach that
the maximum number that can be represented would be 10^25 -1 and it should be equal to 2^n -1 (to represent maximum decimal digit in binary digits),so we get
2^n=10^25 ___> n=floor(25log(10) base(2) )+1 .

but my question is that when 1 digit can be represented in 4 bits ,then why dnt we directly say it to be 100 bits ,becoz there are 25 digits and eac would require 4 bits for representation, so 25*4 directly

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Shashank Moghe

    Shashank Moghe

    @shashank-94ap1q Oct 13, 2014

    Well, I believe you certainly can, it depends on how you want to store that number. If you want to store it as 4*25 bits, then while reading you have to make sure to read the number in that fashion.
  • radha gogia

    radha gogia

    @radha-BTDzli Oct 13, 2014

    Shashank Moghe
    Well, I believe you certainly can, it depends on how you want to store that number. If you want to store it as 4*25 bits, then while reading you have to make sure to read the number in that fashion.
    but the answer is 84 bits which is calculated through the formula,and nt 100 bits
  • Shashank Moghe

    Shashank Moghe

    @shashank-94ap1q Oct 13, 2014

    Well, that is because you have powers of 2 in representing the decimal number in the binary form. It comes to me as no surprise that the binary representation has lesser length than if you try to represent each digit with 4 bits.
  • radha gogia

    radha gogia

    @radha-BTDzli Oct 13, 2014

    Shashank Moghe
    Well, that is because you have powers of 2 in representing the decimal number in the binary form. It comes to me as no surprise that the binary representation has lesser length than if you try to represent each digit with 4 bits.
    but maximum decimal number with 25 digits would be 2^25 -1 , and this would be repredsented only when we shall have all 25 digits to be 1 ,and therefore ,the answer should be 100 bits na
  • Shashank Moghe

    Shashank Moghe

    @shashank-94ap1q Oct 13, 2014

    2^25 can be represented in binary as the 25th BIT being 1. I am extremely confused by your wording. Explain, in minimum number of words, what you want to get done.
  • radha gogia

    radha gogia

    @radha-BTDzli Oct 13, 2014

    Shashank Moghe
    2^25 can be represented in binary as the 25th BIT being 1. I am extremely confused by your wording. Explain, in minimum number of words, what you want to get done.
    I just want to say that if i have 4 bits then with that i can represent the maximum number 15 ,how it came 2^4-1 ,likewise if i have 2 bits ,then I can represent atmost maximum no.3 hw it came, 2^2-1 ,so similarly if i have a 25 digit number so here i didnt talk about digits,but hw to proceed why is the answer nt 100,when 1 digit which varies as 0-9 can be represented in 4 bits then why is that here 25 digits are represented through 84 bits and nt 100 bits
  • Shashank Moghe

    Shashank Moghe

    @shashank-94ap1q Oct 13, 2014

    I am sorry, I do not understand. From what I understand, I will say this:

    4 bits can represent numbers up to 15 (>9). And a binary representation of a decimal number is an addition of powers of 2. Hence you don't need 100 bits to represent a decimal number of (2^25-1).

    Also, I guess, it is because of the capability of representing 16 decimal values from 0 to 15, that has reduced the necessary bits required to 100-16 = 84.
  • radha gogia

    radha gogia

    @radha-BTDzli Oct 13, 2014

    Shashank Moghe
    I am sorry, I do not understand. From what I understand, I will say this:

    4 bits can represent numbers up to 15 (>9). And a binary representation of a decimal number is an addition of powers of 2. Hence you don't need 100 bits to represent a decimal number of (2^25-1).

    Also, I guess, it is because of the capability of representing 16 decimal values from 0 to 15, that has reduced the necessary bits required to 100-16 = 84.
    Can you plzz elaborate more,still confused
  • Shashank Moghe

    Shashank Moghe

    @shashank-94ap1q Oct 13, 2014

    Since you can express a larger number than 9 in 4 bits, up to 15, hence you do not need 25x4 bits. You can manage with lesser bits than 100.