Why the mammoths went extinct

One thing you learn when you are developing procedural animation software is that when things go wrong, they can go very wrong. Unlike creatures in real life, a virtual creature can fail in very spectacular ways.

The head can fly off the body, knees can bend the wrong way, or parts of the body can simply disappear entirely. When this sort of thing happens, all you can do is start tracking down the bug, and hope that such symptoms won’t pop up in the next public demo.

Recently I managed to track down the cause of one insidious bug. Every once in a while, when my interactive mammoth moved its legs in a particular way, it’s entire upper body would vanish.

It turned out that the problem was a negative number under a square root. For those of you who don’t know, there is no real answer to the question “what is the square root of a negative number.” So when you try to take the square root of a negative number, you get back a result that is, quite literally, not a number.

Once those first “not a number” values show up, everything starts to break. Creatures move in impossible ways, body parts disappear, and general mayhem ensues.

When I next saw my colleagues at the lab, I felt somewhat triumphant. After many hours of searching, I had indeed traced the problem to a negative number under a square root sign.

Of course by this time I was somewhat tired and burnt out and maybe a little sleep deprived. So the way I explained it to my two colleagues was this: “I know why the mammoths went extinct.”

“Why?” asked one colleague.

“Because,” I explained, “there was a negative number under the square root sign.”

To my relief, they both understood completely.

One thought on “Why the mammoths went extinct”

  1. Those are not not a number, they are imaginary.
    Hence, you are imagining your code.
    The mammoth head still exists in another dimension.

Leave a Reply

Your email address will not be published. Required fields are marked *