0
$\begingroup$

I have value 123

in binary system, this is 1111011, which is of length 7.

Is it correct to say 123 is 7 bit number?

$\endgroup$
  • 1
    $\begingroup$ Bit is short of binary digit, so I guess it is ok to say it is a 7 bit number... $\endgroup$ – Djura Marinkov Nov 25 '17 at 22:33
  • $\begingroup$ A 2 bit number can be any $n$ so that $0 \le n < 2^7 = 128$. So ... yeah, why not? $\endgroup$ – fleablood Nov 25 '17 at 22:44
  • $\begingroup$ I guess what you are really asking is is it okay to say that $123$ requires $7$ bits. Yes, it does. All numbers $\ge 64$ require at least $7$ bits. And all numbers $\ge 0$ and $\le 127$ require at most $7$ bits. I think, someone correct me if I'm wrong. A "$7$ bit number" means "can be expressed in $7$ bits" means "requires at most $7$ bits" means "is between $0$ and $2^7 - 1 = 127$". I do not think "$7$ bit" means either requires exactly or requires at least $7$ bits. I am almost certain it means only at most. $\endgroup$ – fleablood Nov 25 '17 at 22:57
1
$\begingroup$

Yes, it would be safe to say that it's a 7 bit number. But keep in mind that if you want to use this information in programming for instance, it would round up to 8 bits (or 1 byte), because there are no 7-bit numerical data types. So if you were to say 7-bit number to a bunch of programmers, that would just mean 8-bit and it'll be better to say 8-bit rather than 7-bit.

$\endgroup$
  • 1
    $\begingroup$ "there are no 7-bit numerical data types" that depends entirely on what programming language you use. $\endgroup$ – orlp Nov 25 '17 at 22:41
  • $\begingroup$ Thank you. But if I say to them i have a 8 bit number, how they will know my range? for example: if i say to you: I have a 4 digit decimal number.. you wouldn't be guessing of those of len 3 $\endgroup$ – Testing man Nov 25 '17 at 22:41
  • 1
    $\begingroup$ @BadrB Look no further than C. struct { unsigned n : 7; } s; s.n is a 7-bit integer type. $\endgroup$ – orlp Nov 25 '17 at 22:48
  • 2
    $\begingroup$ "But if I say to them i have a 8 bit number, how they will know my range?" An $m$ bit number can be anything between $0$ and $2^m - 1$. So I guess your assumption behind you question was that an $m$ bit number requires $m$ bits and can be expressed with $m$ bits. I suppose there are some programers who would interpret $m$-bit as meaning that. If so, the range of a nescessarily $m$-bit number would by $2^{m-1}$ to $2^m - 1$. So a nescessarily 7-bit number would be any number between $64$ and $127$. $\endgroup$ – fleablood Nov 25 '17 at 22:49
  • 1
    $\begingroup$ ... but technically, if $x$ is an $m$ bit number is also an $n$ bit number for all $n \ge m$. So all 7-bit numbers are 8-bit, 9-bit, 375-bit, etc. $\endgroup$ – fleablood Nov 25 '17 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.