Saturday 3 June 2006 — This is over 18 years old. Be careful.
I’ve dealt with chunks of code that seemed done, in that nothing had changed in them for a long time (years), and they were doing their job admirably. Then suddenly one day, a bug turns up in that code that seemed so finished.
Joshua Bloch has me topped: in Nearly All Binary Searches and Mergesorts are Broken, he identifies a bug in binary searches that has been around for 50 or so years. Like the archaeo-bugs I’ve dealt with, they arise because the old code is being used on a slightly new or unusual case. In the sort algorithms, it’s arrays with billions of elements.
Comments
I'm curious, what languages don't have a problem with adding maximum int values?
>>> i = 1
>>> for exp in range(0,101,5):
... print "2^%d: %d" % (exp, i)
... i *= 32
...
2^0: 1
2^5: 32
2^10: 1024
2^15: 32768
2^20: 1048576
2^25: 33554432
2^30: 1073741824
2^35: 34359738368
2^40: 1099511627776
2^45: 35184372088832
2^50: 1125899906842624
2^55: 36028797018963968
2^60: 1152921504606846976
2^65: 36893488147419103232
2^70: 1180591620717411303424
2^75: 37778931862957161709568
2^80: 1208925819614629174706176
2^85: 38685626227668133590597632
2^90: 1237940039285380274899124224
2^95: 39614081257132168796771975168
2^100: 1267650600228229401496703205376
Add a comment: