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 #100071: Strainu's Calculator

by Strainu
Basicly, my program does all the operations as defined by the IEEE 754 standard. It extracts the sign, exponent and mantissa from the parameters, then makes the operation. You can find the exact steps I followed at http://meseec.ce.rit.edu/eecc250-winter99/250-1-27-2000.pdf .
Unfortunately, it contains some ugly code, namely the way i get the bits from the float, using an union.
The code is also quite buggy, as it totaly ignores the standard's requirements for rounding and gradual precision loss.
The code will not work on a machine that does not represents floats as IEEE754 (obviously).
Also, it will probably wown't work on another compiler, because i used a proprietary type, namely __int64.

Download0 Comments