# Do Computers Make Errors of Mathematics?

**URL:** https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410
**Category:** Factual Questions
**Created:** [September 28, 2022, 8:06pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410 "2022-09-28T20:06:12Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![whc.03grady](https://avatars.discourse-cdn.com/v4/letter/w/a6a055/32.png) [@whc.03grady](https://boards.straightdope.com/u/whc.03grady)
#### Post date: [September 28, 2022, 8:06pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/1 "2022-09-28T20:06:12Z")

</div>

Once in a while someone will chide me or another staffer for not counting back change, apparently thinking that method is immune to error. I like to retort that humans have made more mathematical errors in the last five seconds than computers have in the last five decades.  
I mean, humans have made these errors in their heads and on their hands. Input errors into a computer/calculator/cash register don’t count because the machine gave the correct answer, given the input. Which brings me to my question: Can a computer make a mathematical error, at any level of its operation? What would happen if it did? Is my snarky remark (above) even more true than I suspect?

---

<div class="post-metadata">

### Author: ![dolphinboy](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dolphinboy/32/330_2.png) [@dolphinboy](https://boards.straightdope.com/u/dolphinboy)
#### Post date: [September 28, 2022, 8:14pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/2 "2022-09-28T20:14:23Z")

</div>

There are corner cases where not every possible permutation of software is tested. In the case of a cash register, I assume that the testing would be good enough to eliminate all corner cases effectively, but humans, who develop the tests, aren’t perfect and may miss something.

The good news is that errors, even small ones, are often noticed soon after the software is released and the bug is fixed. The bad news is that until the bug is fixed, that error will continue to happen whenever that corner case situation pops up again.

---

<div class="post-metadata">

### Author: ![whc.03grady](https://avatars.discourse-cdn.com/v4/letter/w/a6a055/32.png) [@whc.03grady](https://boards.straightdope.com/u/whc.03grady)
#### Post date: [September 28, 2022, 8:17pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/3 "2022-09-28T20:17:56Z")

</div>

What is the nature of these errors? Is it that the machine can’t return an answer (_e.g._ it’s asked to divide by zero), that it isn’t powerful enough/the universe won’t last long enough to return an answer (_e.g._ it is asked “what is the decimal expression of the value of TREE(3) factorial to the Graham’s Number?”), or that it returns an incorrect answer (_e.g._ 2+2=7.448)?

---

<div class="post-metadata">

### Author: ![Telemark](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/telemark/32/372_2.png) [@Telemark](https://boards.straightdope.com/u/Telemark)
#### Post date: [September 28, 2022, 8:21pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/4 "2022-09-28T20:21:37Z")

</div>

> **[Pentium FDIV bug](https://en.wikipedia.org/wiki/Pentium_FDIV_bug)**
>
> The Pentium FDIV bug is a hardware bug affecting the floating-point unit (FPU) of the early Intel Pentium processors. Because of the bug, the processor would return incorrect binary floating point results when dividing certain pairs of high-precision numbers. The bug was discovered in 1994 by Thomas R. Nicely, a professor of mathematics at Lynchburg College. Missing values in a lookup table used by the FPU's floating-point division algorithm led to calculations acquiring small errors. While th...

---

<div class="post-metadata">

### Author: ![whc.03grady](https://avatars.discourse-cdn.com/v4/letter/w/a6a055/32.png) [@whc.03grady](https://boards.straightdope.com/u/whc.03grady)
#### Post date: [September 28, 2022, 8:26pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/5 "2022-09-28T20:26:35Z")

</div>

> When the original array for the Pentium was compiled, five values were not correctly downloaded into the equipment that etches the arrays into the chips – thus five of the array cells contained zero when they should have contained +2.

It seems to me this was a human error; I’m guessing people did the compiling and/or downloading and/or etching? Were not these processors returning the correct values for computations _given how they were made_?

---

<div class="post-metadata">

### Author: ![EinsteinsHund](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/einsteinshund/32/8400_2.png) [@EinsteinsHund](https://boards.straightdope.com/u/EinsteinsHund)
#### Post date: [September 28, 2022, 8:26pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/6 "2022-09-28T20:26:59Z")

</div>

Rounding errors (that easily can accumulate) are a bane in programming.

---

<div class="post-metadata">

### Author: ![whc.03grady](https://avatars.discourse-cdn.com/v4/letter/w/a6a055/32.png) [@whc.03grady](https://boards.straightdope.com/u/whc.03grady)
#### Post date: [September 28, 2022, 8:27pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/7 "2022-09-28T20:27:42Z")

</div>

What is the nature of rounding errors?

---

<div class="post-metadata">

### Author: ![beowulff](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/beowulff/32/542_2.png) [@beowulff](https://boards.straightdope.com/u/beowulff)
#### Post date: [September 28, 2022, 8:30pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/8 "2022-09-28T20:30:45Z")

</div>

That’s a useless distinction.  
Say you had a device (like an adding machine) that generated incorrect results as it wore out. That is still a human error, since humans designed the machine.

---

<div class="post-metadata">

### Author: ![EinsteinsHund](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/einsteinshund/32/8400_2.png) [@EinsteinsHund](https://boards.straightdope.com/u/EinsteinsHund)
#### Post date: [September 28, 2022, 8:31pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/9 "2022-09-28T20:31:52Z")

</div>

> [@whc.03grady](#):
>
> What is the nature of rounding errors?

I used to be a programmer, but I’m no expert for this subject, there are others here who can explain it better. If your program does a lot of floating point calculations (floating point variables represent real numbers), there are always rounding errors, depending on the precision or bit-length of the variables. If the programmer isn’t careful, this can lead to massive errors on run-time.

---

<div class="post-metadata">

### Author: ![whc.03grady](https://avatars.discourse-cdn.com/v4/letter/w/a6a055/32.png) [@whc.03grady](https://boards.straightdope.com/u/whc.03grady)
#### Post date: [September 28, 2022, 8:37pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/10 "2022-09-28T20:37:30Z")

</div>

Fair enough, maybe. I’m not trying to No-True-Scotsman the meaning of “human error” or “error” here, really I’m not.  
There seems to be room for me to say a calculator _intentionally_ designed to return “7.448” when asked “2+2=?”; a calculator _mistakenly_ designed to return “7.448” when asked “2+2=?”; and a calculator that, when asked “2+2=?” returns “7.448” for reasons _not related_ to its design (but rather its functioning, I guess, if that makes sense?) are making different kinds of errors. The first two are related, and are human. The last isn’t, if such errors occur or indeed if they _can_ occur. That’s what I’m wondering.

---

<div class="post-metadata">

### Author: ![TriPolar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tripolar/32/3008_2.png) [@TriPolar](https://boards.straightdope.com/u/TriPolar)
#### Post date: [September 28, 2022, 8:38pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/11 "2022-09-28T20:38:39Z")

</div>

Rounding functions are well defined. If rounding errors accumulate it’s because of human error.

---

<div class="post-metadata">

### Author: ![EinsteinsHund](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/einsteinshund/32/8400_2.png) [@EinsteinsHund](https://boards.straightdope.com/u/EinsteinsHund)
#### Post date: [September 28, 2022, 8:40pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/12 "2022-09-28T20:40:20Z")

</div>

I know, but human errors occur. Even among programmers 😉.

---

<div class="post-metadata">

### Author: ![TriPolar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tripolar/32/3008_2.png) [@TriPolar](https://boards.straightdope.com/u/TriPolar)
#### Post date: [September 28, 2022, 8:41pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/13 "2022-09-28T20:41:18Z")

</div>

Computers failing to operate as intended are equivalent to a human having a stroke. Is that an error of mathematics or general disfunction?

---

<div class="post-metadata">

### Author: ![ctnguy](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@ctnguy](https://boards.straightdope.com/u/ctnguy)
#### Post date: [September 28, 2022, 8:43pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/14 "2022-09-28T20:43:23Z")

</div>

A computer that is correctly designed, running software that is comprehensively tested, can still make a calculation error if a bit in memory is randomly flipped by a cosmic ray. Here is a video from Veritasium that explains the phenomenon:

[![](https://img.youtube.com/vi/AaZ_RSt0KP8/maxresdefault.jpg "The Universe is Hostile to Computers") ](https://www.youtube.com/watch?v=AaZ_RSt0KP8)

---

<div class="post-metadata">

### Author: ![Pardel-Lux](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pardel-lux/32/20182_2.png) [@Pardel-Lux](https://boards.straightdope.com/u/Pardel-Lux)
#### Post date: [September 28, 2022, 8:44pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/15 "2022-09-28T20:44:33Z")

</div>

I don’t know if it counts as a rounding error, but there are numerous cases where a computer will say the answer is 0.999999999 when the answer is 1. It happens often with logarithms, but not only. Would never happen with a pencil and paper if you understand what you are doing, but the computer does not _see_ that, because it goes thru the programming steps. It seems unavoidable.

---

<div class="post-metadata">

### Author: ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)
#### Post date: [September 28, 2022, 8:45pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/16 "2022-09-28T20:45:06Z")

</div>

There are a bunch of different types of errors we could be talking about.

There are of course bugs, where the human has commanded the computer to do the wrong thing. There are also hardware errors, where perhaps there is some latent defect, or the computer is being operated outside of its design range.

The most subtle kind of error is where the machine is operating as designed, but the user isn’t aware of some subtleties. For instance, in most computers, 0.1 \* 10 does not equal 1.0. That’s not an error of mathematics, exactly–it has to do with the way numbers are represented. The small difference is likely not noticeable most of the time, but a user expecting that expression to hold _exactly_ may think it’s an error because it differs from the usual mathematics where it does hold exactly.

It is possible to design correct code with as much confidence as we have in any mathematical proof. It’s also possible to design exceptionally reliable hardware. For some loose definition of “never”, we could say that such a computer would never make an error.

Even normal computers are exceptionally reliable, though. All of their basic instructions are essentially math operations: add, multiply, compare, etc. And they perform billions of these per second, for years, often with no errors. Even if your program crashes, it’s likely that the computer itself was still behaving correctly.

---

<div class="post-metadata">

### Author: ![TriPolar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tripolar/32/3008_2.png) [@TriPolar](https://boards.straightdope.com/u/TriPolar)
#### Post date: [September 28, 2022, 8:45pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/17 "2022-09-28T20:45:47Z")

</div>

We made most of those ‘mistakes’ intentionally to keep our jobs secure.

---

<div class="post-metadata">

### Author: ![DocCathode](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/doccathode/32/18773_2.png) [@DocCathode](https://boards.straightdope.com/u/DocCathode)
#### Post date: [September 28, 2022, 8:48pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/18 "2022-09-28T20:48:01Z")

</div>

Fascinating stuff. I love the Dope!

---

<div class="post-metadata">

### Author: ![engineer\_comp\_geek](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/engineer_comp_geek/32/504_2.png) [@engineer\_comp\_geek](https://boards.straightdope.com/u/engineer_comp_geek)
#### Post date: [September 28, 2022, 8:49pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/19 "2022-09-28T20:49:53Z")

</div>

You have to be very careful doing math in a computer.

One example is with integer math. Take the number 10. Divide it by 6. Multiply that result by 6. Obviously you should get the number 10 as the result. The computer gives you 6. 10/6 = 1 in integer math, and 1x6 = 6.

You end up with similar weirdness with floating point numbers. Computers use base 2 (binary) arithmetic, and 1/10 in base 2 is an infinitely repeating number (0.00011001100110011…). A floating point number only holds a fixed number of bits, so you can’t possibly store 1/10 in a floating point number accurately. The Patriot Missile system in the first Gulf War had a famous bug where the missile tracking system became extremely inaccurate the longer it was powered on. Ultimately, this bug was due to this 1/10 rounding “bug” and the way that the Patriot did its timing calculations.

---

<div class="post-metadata">

### Author: ![Telemark](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/telemark/32/372_2.png) [@Telemark](https://boards.straightdope.com/u/Telemark)
#### Post date: [September 28, 2022, 9:04pm UTC](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410/20 "2022-09-28T21:04:52Z")

</div>

> [@whc.03grady](#):
>
> It seems to me this was a human error

Since computers are designed and built by humans, all computer errors are ultimately human errors.

[Next page](https://boards.straightdope.com/t/do-computers-make-errors-of-mathematics/972410.md?page=2)
