The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

Entry #100051 - How Machines Probably Do It

Last post 06-11-2007 12:09 PM by Alex Papadimoulis. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 06-11-2007 12:09 PM

    Entry #100051 - How Machines Probably Do It

    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.
Page 1 of 1 (1 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems