This is the ninth article in a twelve-part series that discusses the twelve finalists and their calculator submissions for the OMGWTF Programming Contest. The entries are being presented in the order submitted, and the winner will be announced on June 18, 2007.


Why spend time developing a new, unfamiliar User Interface when a perfectly good one has been in production for over thirty years? That must have been what Terry Lyons thought when he put together Entry #100253 (Terry’s Calculator). The long-established UI that he used was a bona-fide solar-powered desk calculator. Or, at least, a scanned picture of one on a wooden table:

Of course, simply having a Web 0.1-inspired UI isn’t nearly enough to be considered a finalist in this competition. The implementation of mathematics behind Terry’s Calculator is about as badly done as using a picture of something for the user interface.

Calculations are implemented as recursive functions that use XML (enterprisey!) to communicate with each other. Like any good application that has to spend a lot of time doing calculations, Terry’s Calculator uses a background thread to do the calculations. Unlike a good application, it ignores thread safety, leaks memory like a sieve, and requires a good 100MB+ of memory to run.

Feel free to run the application (TerrysCalculator.exe), but just make sure it doesn’t hang around as an open process. I made the mistake of dividing two large numbers, gave up after a few minute wait, and, after ten minutes of wondering why my computer was so slow, went in to task manager to kill the 400MB+ process consuming 80% of the CPU. Actually, better yet, just run this on your coworker’s workstation.

CalcFunc.cpp has a handful of fun bits in it (download code at end of article), including this bit of optimization code…

	// Optimization - Divide( 1000000, 10 ) takes a very long time,
	// I don't know exactly how long because I gave up on it after
	// several minutes.  The for loop ends with the same result but
	// much faster
	//exp = pcalc->Divide( exp, 10, tempDec );
	exp = 1;
	for ( long i = 0; i < totalDigits - 1; i++ )
	{
		exp = calc.Multiply( 0, 10, exp );
	}

As for the author, Terry Lyons hails from Waterloo, Ontario, the home town of his Alma Mater, the University of Waterloo. He got into programming after watching some guy write a videogame on the TV show “That’s Incredible.” It blew his ten-year-old mind that someone could actually do something like that.

Terry is a bit reluctant, however, on whether he’d use his own calculator in place of Window’s:

Mine has a lot more buttons that must mean it is better right? On the other hand, all of calc.exe’s buttons do something and it handles a wider range of calculations.

Download Entry #100253, Terry's Calculator (ZIP File)