# Calculating the difference: a look at calculator accuracy in iOS

Today's date is 11-12-13, so it is only fitting that we spend some time with the iPhone calculator. In an earlier post, we covered some cool calculator tricks. Now, we will take a look at how accurately the iPhone crunches its numbers.

There are a series of simple math tests that can be used to assess the relative accuracy of a calculator. These computations address how many digits a calculator looks at when it does its number crunching and the way it rounds off these numbers. We ran the iPhone 5s with iOS 7, an iPhone 4 with iOS 6 and and iPod Touch with iOS 5 to see how the different iOS versions compare.

### The iPhone Calculator

Before we dive into the calculations, let's take a quick look at the calculator app itself. The calculator app can be operated in two modes -- portrait as a standard calculator and landscape as a scientific calculator. The portrait mode displays up to 9 digits, while the landscape shows up to 16 digits. The number of displayed digits was identical for iOS 5, 6 and 7.

### Accuracy Tests

1. Square of root two.

When you calculate the square root of two and multiply it by the square root of two, you should get back the original number in the equation -- 2. An accurate calculator will show the result as two, while a less accurate calculator will display 1.99999.

**Results**: All the iOS versions passed with flying colors, producing the correct value of 2 for an answer.

2. Sine of a really small angle

Change the calculator to radians and use it to calculate the sine of a small number like 0.01. THe result should be close to the original number used in the calculation. In this case, the sine of 0.01 is 0.00999. Keep reducing this number until the calculated value equals the original value (when the sine of 0.00001 equals 0.00001 and not 0.00000999). An average calculator will measure 0.00001 before it can't calculate the value anymore.

**Results**: All the iOS versions were able to calculate to 0.0001, which is slightly below average.

3. One divided by nine test

Basic fractional math tells us that one divided nine and then multiplied by nine (1/9 x 9) should equal one. An accurate calculator will spit out the number 1, while an inaccurate one will report the answer as 0.99999.

**Results**: All the iOS versions passed with flying colors, producing the correct value of 1 for an answer. Interestingly enough, I tested this on my MacBook Air running OS X Mavericks and it produced an inaccurate answer of 0.99999.

### Error Checking

Besides the number of significant figures in a calculation, you should also look at a calculator's ability to handle equations that do not produce a valid number. A good calculator should produce an error with these types of equations. Stay away from those calculators that produce a value no matter what you type into the equation.

1. The square root of a negative number

You can't take the square root of a negative number. If you try this calculation, your calculator should give you a warning.

**Results**: All the iOS versions passed with flying colors.

2. Dividing by zero

Though you can divide a number by one, dividing a number by zero is not possible. If you try dividing any number by zero, your calculator should throw an error.

**Results**: All the iOS versions passed with flying colors.

### Correct Order of Operations

Last, but not least is the order of operations test. This borrows from elementary math, which teaches kids the correct order in which to add, subtract, multiply or divide in a long equation.

The order of operations rule requires you to calculate items in a specific order and can be recalled using the acronym BODMAS. First, calculate items in the Brackets and then calculate the Orders (exponents and square roots) before do anything else. Next, you should Multiply or Divide before you add. Lastly, you should solve the remaining Addition and Subtraction by calculating from left to right.

In this test, you will see how the calculator can handle a mixed operation equation. A good calculator will remember to follow these rules, while a poorly written one will make the classic error of adding before multiplying. Below are some example calculations which I used to test the various iOS device. I included parentheses and exponents to make the test even more challenging.

- 5 + 2 x 5 = 15
- 6 × (5 + 3) = 48
- 5 × 2^2 = 20

**Results**: All the iOS versions passed with flying colors. Order of operations is followed to a T.

### Software Updates

more updates- Apple Remote Desktop updated with Yosemite support
- OS X Yosemite 10.10.2, iOS 8.1.3 updates now available
- Sports Illustrated 120 SPORTS channel comes to Apple TV
- Logic Pro X update brings AirDrop support, new effects, tools, and more
- Parallels Access 2.5 released, adds file manager, computer-to-computer remote access
- The Google Translate iOS app is about to get a lot smarter