A. Murat Eren was browsing through the (open) source of a program called YUM (which, from what I can tell, has something to do with Linux, hot dogs, and a magical kitchen appliance called a "recipe maker") and sent in a little snippet from it. Now, there's nothing really wrong with the code. It's actually researched, written well, and commented. But none the less, I found it pretty entertaining ...
symbols = ['', # (none) 'k', # kilo 'M', # mega 'G', # giga
'T', # tera 'P', # peta 'E', # exa 'Z', # zetta 'Y'] # yotta # ... snip ... thresh = 999 depth = 0 while number > thresh: depth = depth + 1 number = number / 1024 # just in case someone needs more than 1000 yottabytes! diff = depth - len(symbols) + 1 if diff > 0: depth = depth - diff number = number * thresh**depth
Yes, that's right, "just in case someone needs more than 1000 yottabytes!" Those of us lucky enough to have a terabyte are 1,000,000,000,000 times short of a yottabyte. In terms of Compact Discs Dual Layer DVDs, we'd need to build a stack high enough to reach the moon ... and back ... and there again ... (SNIP: 396 trips) ... and finally back again .... just to have a yottabyte worth of data. A stack of 3.5" floppy discs with 1,000 yottabytes would be tall enough to make it to the sun. 14 Million times. But still ... just in case ...