r/AskComputerScience • • Nov 23 '15

Do computers make calculation errors?

If computers can make billions of calculations per second, is there an expected calculation error rate they make? If so, is there some sort of correction process? If the calculations are really just tiny jolts of electricity going through logic gates, is there ever chance for an error? If I give excel 100,000 cells to perform a calculation on, is it possible for one of the calculations to be incorrect mathematically?

Thank you.

30 Upvotes

11 comments sorted by

View all comments

9

u/[deleted] Nov 23 '15

There are basically two kinds of errors that can corrupt your computation results: systematic errors caused by bugs in the design of hardware and software, and random errors caused by the environment.

Systematic errors are just that—bugs that are baked into the design of the hardware and software. Errors like the famous Pentium floating point division bug, overflow and underflow problems, rounding errors, and plain old logic errors, fall into this category. These errors are deterministic, i.e. given a particular initial system state they will always occur, and produce the same erroneous result.

Random errors are introduced by flaws in silicon, environmental factors like heat or cosmic rays, or defects in manufacturing. These errors are probabilistic, which means you can't predict when exactly they're going to happen. The results of such errors depend on where they occur on the system, and range from having no effect, to corrupting your output, to causing your entire system to fail.

Mitigations for random errors are costly because there's no perfect way to remove them. While you can ensure manufacturing quality or keep your system cool, you can't shield your device against neutron rays—not even with layers of lead.

One of the most insidious things a neutron ray can do is "flipping bits" in your working RAM. Since modern computers contain so much RAM that take relatively little energy to "flip", this presents a large surface of vulnerability. ECC RAM was introduced to reduce the effects of bit-flips by storing additional bits of memory that can be used to detect and repair flipped bits within a word.

ECC RAM can only reduce but not eliminate these random errors: flip enough bits in a word and even ECC is powerless to correct them. There are also computing surfaces that are completely unprotected, such as L1 cache and registers. Luckily, these latches tend to take much more energy to flip, and so the number of cosmic particles that can flip them are relatively few.

So, tl;dr: Yes, there is an expected rate of error of computation. Some of them happen predictably because of design bugs, and others unpredictably because of random events.