The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+1 vote
406 views
A decimal number has $25$ digits. The number of bits required for its equivalent binary representation is approximately??

according to me I got $83$  but answer given Virtual gate is $75 $please check??? I am right or wrong
in Digital Logic by Loyal (6.2k points)
edited by | 406 views

1 Answer

+2 votes
Maximum number that can be represented with $n-bits$ in base $x$ $= x^n - 1$

Maximum no. with $25$ bits in $base-10$ $=$ $10^{25}-1$ and maximum number with $k$ bits in $base-2$ $= 2^x-1$

In order to be able to be represent every $25-bit$ decimal number with $k$ bits in binary $10^{25}-1 \leq 2^k -1$

$log_{2}(10^{25} ) \leq k$

$25*log_2{10} \leq k$

$k \geq 83.048$   $\rightarrow$ $k = 84$
by Boss (28.4k points)
0
i also doing  same but i have one more doubt how u write inequality like less than or equal  plz explian so answer differ as 83 or 84
+1
k should be more than 83.048, means only 83 bits are not enough to represent 25 digit max decimal.

(like $\log_2(6) = 2.58$ , to represent 6 we need more than 2 bits in binary)
0
Yes, some numbers will not be covered if you use $83$ bits. and When using $84$ bits you will be able to cover all $25$ digit decimal numbers and also some $26$ digit numbers.

Related questions

0 votes
1 answer
3
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,339 questions
55,763 answers
192,339 comments
90,772 users