About The Contest
The first ever Olympiad of Misguided Geeks contest at Worse Than Failure (or OMGWTF for short) is a new kind of programming contest. Readers are invited to be creative with devising a calculator with the craziest code they can write. One lucky and potentially insane winner will get either a brand new MacBook Pro or comparable Sony VAIO laptop.
Entry #100102: Overrated
I wanted to create an application worthy of a large corporation. And a large corporation wouldn't settle for
consumer-grade stuff, right? No. So to avoid giving them what an average guy would get, I had to redefine
some of the basics of programming. For example, I avoid using parameters and return values, they're overrated
anyway. Also, I avoid using local variables. Do you know how much time it takes to initialize a local variable
every single time a function is called? A lot. A lot of time. Instead, I use a set of global variables, which
only have to be initialized once. I even wrote functions to work with the global variables, for future code
But of course I had to go deeper than to redefine a few simple concepts. The main function of this application
is to serve as a calculator. But while most consumer-grade calculators use simple solutions like
answer = op1 + op2, and answer = op1 / op2, I realized that a large corporation would not settle for that. So I
wrote my own functions to handle the operations. That also leaves room for optimization later on. What I'm most
proud of is the multiplication function. It uses two independent algorithms + a lookup table created at startup.
This results in a very accurate function, that theoretically should never give a false result. But it also comes
at a price. If you multiply big numbers, it may take a while. However, with the increased accuracy, it's worth it.
(Disclaimer: The statements above may or may not be true)