# converting decimals to binary is 123 7 bit number?

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?

• Bit is short of binary digit, so I guess it is ok to say it is a 7 bit number... – Djura Marinkov Nov 25 '17 at 22:33
• A 2 bit number can be any $n$ so that $0 \le n < 2^7 = 128$. So ... yeah, why not? – fleablood Nov 25 '17 at 22:44
• 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. – fleablood Nov 25 '17 at 22:57

• @BadrB Look no further than C. struct { unsigned n : 7; } s; s.n is a 7-bit integer type. – orlp Nov 25 '17 at 22:48
• "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$. – fleablood Nov 25 '17 at 22:49
• ... 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. – fleablood Nov 25 '17 at 22:51