There are many ways to represent data using binary like - unsigned, signed magnitude, 1s/2s complement, offset-M, floating-point, ASCII, and Unicode. Why do we need so many different ways?
Asked
Active
Viewed 81 times
2

Peter Cordes
- 328,167
- 45
- 605
- 847

sunny
- 149
- 8
-
is the data that you are representing all of one type? – jsotola Sep 11 '21 at 16:11
-
Representations are *interpretations*. Why we have many interpretation of the same number? Because we have different problems. – Margaret Bloom Sep 11 '21 at 16:35
-
We don't. 1's complement and sign/magnitude integers are not used in modern systems, except maybe in some file formats. And Unicode is a superset of ASCII, so if you decide to use Unicode everywhere, you don't need ASCII anymore. (Although then all your functions have to handle the general case of Unicode where a character isn't fixed length.) – Peter Cordes Sep 11 '21 at 21:50
-
It is useful to have efficient fixed-width types, and variable-length arbitrary-precision formats, though. And to have a text character set so we can print integers into human-readable strings. – Peter Cordes Sep 11 '21 at 21:53
-
1meta question: should [representation] be a synonym of [data-representation] or vice versa? I didn't previously know either tag existed, but there are similar questions in both. Someone should ask on meta, I guess, unless there's an existing discussion. (I'm hoping someone who's seen either of those tags before might post a meta question so I don't have to go digging myself.) – Peter Cordes Sep 11 '21 at 21:59