1
$\begingroup$

I understand that a computer memory sequential word must always include at least two bits so it must be binary and therefore cannot be unary.

Must a word be binary (and never unary)?
That is to ask; can there be a "unary" computer memory sequential word?


This question might relate to my other question - Must a Turing machine tape be binary?

$\endgroup$

1 Answer 1

1
$\begingroup$

Machine words have fixed length. Denoting the length by $n$ and the base by $b$, each machine word has $b^n$ possible values, and so stores $\log_2 (b^n)$ bits of information.

A base can be binary or decimal and so forth; if $b=1$ then the machine word has a single possible value, and so stores no information. It would be useless.

Unary encoding is only relevant in contexts where the length is not fixed.

$\endgroup$
4
  • $\begingroup$ No. Decimal is base 10, binary is base 2, and so on. $\endgroup$ Commented Jan 31, 2021 at 8:40
  • $\begingroup$ Unary encoding is only relevant in contexts where the length is not fixed. This is a very interesting read for me; I never read about such situations anywhere, would you say it's part of fringe theories of computer science? Are there computers which at least theoretically work this way and could produce similar output to the one we can get with RAM modeled or Turing-Machine modeled computers? $\endgroup$
    – Semo
    Commented Jan 31, 2021 at 9:56
  • $\begingroup$ It would be a folly to use unary encoding, since it’s exponentially less efficient than other encodings. $\endgroup$ Commented Jan 31, 2021 at 10:28
  • $\begingroup$ @YuvalFilmus Well that's not entirely true. Unary encoding is used in data compression for symbols where the expected frequency of the symbols follows a geometric distribution. See, for example, Golomb-Rice coding, which is used in inverted index compression, as well as many codecs like FLAC and MP4-ALS. en.wikipedia.org/wiki/Golomb_coding $\endgroup$
    – Pseudonym
    Commented Feb 1, 2021 at 1:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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