Anton N is not a programmer by trade. Whenever he comes across “questionable” code in his job as an engineer, he always gives the programmer the benefit of the doubt: it might just have to be that complicated to work; maybe he did it to work around some system limitation; or perhaps it’s some optimized routine. It’s only fair. Certainly, he wouldn't want some programmer critiquing his decision to use the modial interaction of magneto-reluctance (rather than a more efficient method, such as capacitive directance) for supplying inverse reactive current in a unilateral phase detractor.

Not too long ago, Anton had one of those questionable code moments. It all started when he noticed some rather bizarre readings and strange error messages come up in the Test Control System. The TCS is a C-based application that was built by in-house programmers over the course of several years. It was designed so that, theoretically, it could monitor an unlimited number of devices (of any possible type), each which could provide an unlimited amount of input via an unlimited amount of connections. In reality, Anton and his fellow engineers use the TCS to monitor one, maybe two, temperature control devices that they build for use in large-scale industrial equipment.

Unsure of what exactly the TCS was telling him, Anton went to the source code. Usually, that’s where most problems were found. While paging through the Temperature Device Module, Anton noticed some rather oddly formatted code…

int K2C(Ktemp int) { //See tempconv.xls if(Ktemp= 273 ){return 0 } else if(Ktemp= 274 ){return 1 } else if(Ktemp= 275 ){return 2 } else if(Ktemp= 276 ){return 3 } else if(Ktemp= 277 ){return 4 } else if(Ktemp= 278 ){return 5 } else if(Ktemp= 279 ){return 6 } else if(Ktemp= 280 ){return 7 } else if(Ktemp= 281 ){return 8 } else if(Ktemp= 282 ){return 9 } else if(Ktemp= 283 ){return 10 } else if(Ktemp= 284 ){return 11 } else if(Ktemp= 285 ){return 12 } else if(Ktemp= 286 ){return 13 } else if(Ktemp= 287 ){return 14 } else if(Ktemp= 288 ){return 15 } else if(Ktemp= 289 ){return 16 } else if(Ktemp= 290 ){return 17 } else if(Ktemp= 291 ){return 18 } else if(Ktemp= 292 ){return 19 } else if(Ktemp= 293 ){return 20 } else if(Ktemp= 294 ){return 21 } else if(Ktemp= 295 ){return 22 } else if(Ktemp= 296 ){return 23 } else if(Ktemp= 297 ){return 24 } else if(Ktemp= 298 ){return 25 } else if(Ktemp= 299 ){return 26 } else if(Ktemp= 300 ){return 27 } else if(Ktemp= 301 ){return 28 } else if(Ktemp= 302 ){return 29 } else if(Ktemp= 303 ){return 30 } else {printf("Temp out of range")} }}

Clearly, the method was used to convert Kelvin to degrees Celsius. Anton wasn’t quite sure why this was used instead of "return Ktemp-270;", but he looked past it. After all, there was something far stranger in the code…

// See tempconv.xls

It was as if the code was telling him something.

Anton… oh Anton , go see tempconv.xls. Come on, Anton. You know you wanna, Anton. Do it, Anton! Do it!

He knew that tempconv.xls certainly wouldn’t be good for his quickly fleeting sanity, but he just had to take a look. He dug further in the src directory and opened up tempconv.xls.

Anton clicked through the cells – B1, D1, B2, D2, B3, D3 – and noticed something even stranger: the cells were not set up as formulas. Someone had apparently typed each Kelvin and degree Celsius value in by hand. In retrospect, it probably would have been even more strange if the C-programmer was able to code an Excel formula, but not one in C.

As Anton rubbed his eyes and dreamt of the Test Control System magically melting away, something else occurred to him. The temperature devices that they build communicate only in Kelvin: there’s no conceivable reason that they’d ever need to see or use Celsius. In fact, doing so would add nothing but confusion.

Against his better judgment, Anton did a search through the codebase for "K2C" ...

Occurrence 1: //calc the deltas deltaA = K2C(tempA1) - K2C(tempA2); deltaB = K2C(tempB1) - K2C(tempB2); deltaC = K2C(tempC1) - K2C(tempC2); deltaD = K2C(tempD1) - K2C(tempD2); Occurrence 2: rDev = abs( K2C(temp) - K2C(avg) )

Those were the only two usages of K2C that Anton could find.

After digging through the code for a few more mintues – and doing his best to avoid more "investigations" into functions like K2C – Anton realized that the Test Control System couldn’t possibly be the culprit. This whole time, it was his fault: he neglected to connect the temperature control board’s panendermic semiboloid to the "up" end of his grammeter. Obviously, this caused very high levels of sinusoidal depleneration and, hence, strange readings. And to think… he was about to call the programmer’s work a WTF!