# Google and Significant Digits

Even though I have a nostalgic fondness for the HP-48 - maybe the best calculator ever made in terms of tactile delight - I've grown rather accustomed to typing formulas in to Google when I need to do some quick math. Today I discovered that it sometimes doesn't treat all of your digits as significant. In a sense, this is probably the most *correct* way to handle math, but it will be confusing for a large number of users.

Go ahead and try the following:

```
1411560000000 - 50000
```

The answer comes back as 1.41156e+12, which of course is the same (to the majority of the population which has not studied significant digits) as 1411560000000.

Or try:

```
1411560000000 - 1
```

Also 1.41156e+12

Or hey, let's do some addition!

```
1411560000000 + 50000
```

1.41156e+12

Of course, when you're dealing with a nice round(ish) number like 1411560000000 it's pretty easy to see that Google has lopped off a few digits. In fairness, 1.41156e+12 isn't even wrong, per se, but it's easy to imagine people who aren't familiar with the concept of significant digits getting confused.

Interestingly, it will consider extra digits within the whole part of the number as significant, this

```
1411560000001 - 50002
```

comes back as 1.4115599e+12. However, throwing some zeros after the decimal point doesn't do you any favours;

```
1411560000000.0000 - 50000.0
```

still comes back as 1.41156e+12.

Fortunately, you **can** tell Google that these digits are, in fact, significant by using scientific notation. If you rephrase the first example as:

```
1.411560000000e+12 + 5.0e+5
```

You'll find you get 1.4115605e+12, as expected.

Google doesn't appear to be completely rigorous in its handling of this, though. If I take one 0 off of each number in the original problem, and do 141156000000 - 5000, the result is 141155995000. Let's say we want to multiply that by 10 - just add a zero, right? Nope! It turns out that:

```
(141156000000 - 5000) * 10 = 1.41156e+12 = 141156000000
```

which is less precision than we had while working one magnitude lower. It looks like they've decided to apply rigorous interpretation of significant digits once you start handling numbers over 1 trillion. 1.2 trillion minus ten thousand result in 1.2 trillion, while 120 billion minus 1 thousand yields 119999999000.

Mostly, be careful when using Google to add millisecond timestamps!