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.

Navigation

Advertisements

Entry #100051: How Machines Probably Do It

by Andrew M. Kasper
This solution implements in software what machines probably do in hardware.

DoAdd: Since floats are probably just represented as integers divided by some multiple of 10, this solution assumes that all input values are integers. It converts the values into a bitset, puts them through a custom ALU, converts them back into integers, converts that value into a float and then returns the float value.

DoSub: Linearly searches x until DoAdd(x, op2) == op1.

DoMul(x, y): Linearly performs temp = DoAdd(temp, y) x times.

DoDiv: Linearly searches x until DoMul(x, op2) == op1.

Download0 Comments