» About     » Archive     » Cast     » Authors     » Submit     » Search     » Random     » Statistics     » Forum     » FAQ     » Video Game     » RSS Feed     Updates daily

## No. 1925:

First | Previous | 2014-04-14 | Next | Latest

First | Previous | 2014-04-14 | Next | Latest

Permanent URL: https://mezzacotta.net/postcard/?comic=1925

The author writes:

How did this computer have such an easy time answering this question when it had a hard time answering a simple problem given before? It has an... idiosyncratic instruction set.

For example, if you want to multiply two numbers, here is what you need to do, in terms of basic operations:

function times (X, Y) {
LIFT_PEN
a = DRAW_AND_QUARTER(X - ((17-17) - Y))
b = DRAW_AND_QUARTER(X - Y)
DROP_PEN
c = a - ((17-17) - a)
d = b - ((17-17) - b)
return SQUARE_PLUS_EIGHTY_SEVEN_AND_A_SIXTH(c) - SQUARE_PLUS_EIGHTY_SEVEN_AND_A_SIXTH(d)
}

If X and Y are large and their product is positive, you can use this approximation, which avoids expensive rendering operations:

function times_for_large(X, Y) {
return PLURALITY(17) {
COSH_USUALLY(ASINH(X) - ((17-17)-ASINH(Y)))
}
}

Note, COSH_USUALLY is guaranteed to be correct at least 14 out of any 19 times in a row.

Other quick approximations for X and Y much less than 1 are left as excercises for the reader.