7

I am teaching the course "Introduction in Programming" for the first-year students and would like to find interesting examples where the datatype size in bits, chosen by design, led to certain known restrictions or important values.

Here are some examples:

  1. Due to the fact that the Bell teleprinter used 7-bit-code (later accepted as ASCII) until now have we often to encode attachments in electronic messages to contain only 7 bit data.
  2. Classical limitation of 32-bit address space leads to the 4Gb maximal RAM size available for 32-bit systems and 4Gb maximal file size in FAT32.

Do you know some other interesting examples how the choice of the data type (and especially its binary length) influenced the modern IT world.

Added after some discussion in comments:

I am not going to teach how to overcome limitations. I just want them to know that 1 byte can hold the values from -127..0..+127 o 0..255, 2 bytes cover the range 0..65535 etc by proving examples they know from other sources, like the above-mentioned base64 encoding etc. We are just learning the basic datatypes and I am trying to find a good reference for "how large" these types are.

Alexander Galkin
  • 1,870
  • 1
  • 14
  • 18
  • The goal of designing "infinitely future-proof" technology is not achievable. Instead, we strive to design "intention-revealing code" and "self-describing data" so that the additional information (intention, and description) will ease the migration of code and data to their future formats. – rwong Nov 19 '11 at 19:38
  • This is absolutely clear to me and to the students. The basic idea here is to get used to the 8-bit-pro-byte world and to get some overview of "how much data" one, two, four etc. byte structures may hold. – Alexander Galkin Nov 19 '11 at 19:44
  • My suggestion is to look for examples which are contemporary with the students' age. That is, they may not fully appreciate the situation in old technologies, the price of RAM, etc. (At one point, a 64KB memory module is a separate enclosing outside the computer, made of hand-woven magnetic cores.) – rwong Nov 19 '11 at 19:51
  • If you want to teach how to overcome the limitations, teach binary additions with carry, [prefix code](http://en.wikipedia.org/wiki/Prefix_code) (needed to understand machine instructions), Unicode (an example of a coding scheme), and invite the students to design an ad-hoc coding scheme for fun. Touch on a little bit of "information" and "entropy". – rwong Nov 19 '11 at 20:02
  • Maybe I formulated my question in a bit vague way: I am not going to teach how to overcome limitations. I just want them to know that 1 byte can hold the values from -127..0..+127 o 0..255, 2 bytes cover the range 0..65535 etc by proving examples they know from other sources, like the above-mentioned base64 encoding etc. We are just learning the basic datatypes and I am trying to find a good reference for "how large" these types are. – Alexander Galkin Nov 19 '11 at 20:31
  • In IBM PC-compatible master boot records, the partition table can't express partitions that are larger than or start further than 2 TB. This is because the sector size is fixed to 512 (the first sector of a disk contains the MBR; as a consequence, you initially have only 440 bytes of boot code) and the offset and size can at most be `2^32-1` sectors. To fix this, GUID partition tables are used now. – Rhymoid Nov 19 '11 at 20:43
  • After many years of unnecessary confusion the world's standard bodies made binary prefixes a ubiquitous standard. After well over a decade teachers are still inflicting their students (and therefore the rest of the IT industry, and general population) with continued ignorance. For the future of mankind these people need to be stopped. Please learn the difference between Gb, GB, Gib and GiB - they are all very different quantities. Thanks. – Brendan Nov 20 '11 at 17:49
  • [Here's a good jumping off point](https://www.ibm.com/developerworks/mydeveloperworks/blogs/anthonyv/entry/497_the_number_of_the_it_beast2?lang=en) for one version, the "497 day bug." – Josh Nov 19 '11 at 20:52

3 Answers3

8

IPv4 is a very good example where a limited spec size caused a very expensive problem down the line. 4.3 billion addresses just aren't enough anymore. Now ISPs around the world are desparately rolling out IPv6 with a 128-bit address space which translates into an address for every atom in your body or something like that.

Wyatt Barnett
  • 20,685
  • 50
  • 69
  • 1
    Yeah - Consider this: If there were 1 million addresses allocated every picosecond, it would take 10783127828133.15 years to consume them all. There are 2^128 addresses available with IPV6. In one second, there are 10^6 / 10^-12 addresses allocated (1 x 10^18). So (2^128) / ( (10^6) / (10^-12) ) = 340282366920938463463.37 seconds. Assuming there are 31,556,926 seconds in a year (according to google.com), this yields 10783127828133.15 years. Since this is older than the earth, we should be fine. – Jack Nov 20 '11 at 00:08
  • @Jack the Y11T problem? :) –  Nov 20 '11 at 02:32
  • @Jack : until we aren't, we are going to lose a lot of address due to network segmentation. – Wyatt Barnett Nov 20 '11 at 02:33
1

The year 2000 problem was similar, except that people used decimal numbers instead of binary, and encoded just two last digits. This can be a useful example if explaining to someone who has little experience with binary.

FAT12/FAT16/FAT32 were adapted to cover for bigger and bigger storage.

TeX has some interesting properties when representing dimensions (from The TeXBook):

TEX represents all dimensions internally as an integer multiple of the tiny units called sp. Since the wavelength of visible light is approximately 100 sp, rounding errors of a few sp make no difference to the eye. [...]

TEX will not deal with dimensions whose absolute value is 2^30 sp or more. In other words, the maximum legal dimension is slightly less than 16384 pt. This is a distance of about 18.892 feet (5.7583 meters), so it won’t cramp your style.

(pt is a typographic unit approximately equal to 1/72 of inch)

liori
  • 725
  • 5
  • 16
0

Microsoft Excel - try to graph more than 32K items. There's got to be a signed 16 bit field in there somewhere. (although they round the limit down to 32000 even for some reason).

AShelly
  • 5,793
  • 31
  • 51