Comments on: Why is Numbers (the spreadsheet app) for ios doing this?
http://ask.metafilter.com/296465/Why-is-Numbers-the-spreadsheet-app-for-ios-doing-this/
Comments on Ask MetaFilter post Why is Numbers (the spreadsheet app) for ios doing this?Wed, 01 Jun 2016 07:28:48 -0800Wed, 01 Jun 2016 07:49:10 -0800en-ushttp://blogs.law.harvard.edu/tech/rss60Question: Why is Numbers (the spreadsheet app) for ios doing this?
http://ask.metafilter.com/296465/Why-is-Numbers-the-spreadsheet-app-for-ios-doing-this
I use a Numbers spreadsheet on my iPhone 5S to keep track of my mileage for work. Sometimes -- but not always -- when I do a calculation, it gives me an <a href="http://imgur.com/UO0oJbh">almost-accurate but borked up number</a>. <br /><br /> In one column, I put the mileage on the trip meter when I start driving for the day. In the next column, I enter the mileage when I stop driving. The third column is the difference between the starting and stopping mileage. So if I start at 121.3 and stop at 131.4, the third column should be 10.1. Sometimes when I make this calculation, though, it shows the result as 10.00000000000009 or 10.100000000000002 or something like that. <a href="http://imgur.com/UO0oJbh">Here's a screenshot</a> so you can see what I'm talking about.<br>
<br>
Why? I don't ever change any of the settings or formatting. Sometimes I'll do several calculations in a row and only one of them will turn out weird. How can I make this stop happening?post:ask.metafilter.com,2016:site.296465Wed, 01 Jun 2016 07:28:48 -0800kitty teethnumbersspreadsheetexcelresolvedBy: jessamyn
http://ask.metafilter.com/296465/Why-is-Numbers-the-spreadsheet-app-for-ios-doing-this#4295028
It's a known bug or at least was <a href="https://discussions.apple.com/thread/1366412?tstart=0">several years ago</a>. Have you <a href="https://support.apple.com/kb/PH3373?locale=en_US&viewlocale=en_US">formatted the numbers</a> to be, at most, two decimal places?comment:ask.metafilter.com,2016:site.296465-4295028Wed, 01 Jun 2016 07:49:10 -0800jessamynBy: soelo
http://ask.metafilter.com/296465/Why-is-Numbers-the-spreadsheet-app-for-ios-doing-this#4295033
<a href="https://support.microsoft.com/en-us/kb/78113">Floating Point Arithmetic</a> is the culprit and it is an issue in Excel as well.comment:ask.metafilter.com,2016:site.296465-4295033Wed, 01 Jun 2016 07:50:56 -0800soeloBy: one of these days
http://ask.metafilter.com/296465/Why-is-Numbers-the-spreadsheet-app-for-ios-doing-this#4295034
This looks like it's due to floating-point math. It's a fairly common problem related to how decimal numbers are represented in binary. Basically, some decimal numbers cannot be represented accurately because we have to tell a computer to represent them by summing a series of 1/2, 1/4, 1/8, etc - we can get very close to some numbers, but not exactly. When you start doing calculations involving these "off by a bit" numbers you start to see issues with loss of accuracy.<br>
<br>
I'm not familiar with the app itself, but is it possible for you to change the precision to force fewer decimal points (without truncating)? You may also be able to do something like:<br>
<br>
ROUND((subtraction formula),1) to force it to the nearest tenth. <br>
<br>
Another solution would be to use whole integers for your numbers, but that would be pretty annoying.comment:ask.metafilter.com,2016:site.296465-4295034Wed, 01 Jun 2016 07:51:24 -0800one of these daysBy: w0mbat
http://ask.metafilter.com/296465/Why-is-Numbers-the-spreadsheet-app-for-ios-doing-this#4295040
Jessamyn has it. Change your formatting for that column.comment:ask.metafilter.com,2016:site.296465-4295040Wed, 01 Jun 2016 07:59:07 -0800w0mbatBy: Lanark
http://ask.metafilter.com/296465/Why-is-Numbers-the-spreadsheet-app-for-ios-doing-this#4295048
Not a bug. Standard <a href="https://en.wikipedia.org/wiki/IEEE_floating_point">IEEE floating point</a> math. <br>
Many apps and calculators massage the IEEE result to get rid of the residual error. Apple Numbers does not, they stick with the standard.<br>
<a href="https://discussions.apple.com/message/24295118#24295118">Here's a worked example of 1.1 - 1.0 - 0.1 =</a><br>
<br>
The solution is to round the answer, this does have the advantage of forcing you to think about accuracy, if you start with data as a 2 digit number, assuming that the answer will be accurate to 10 decimal places is usually not justified.comment:ask.metafilter.com,2016:site.296465-4295048Wed, 01 Jun 2016 08:12:20 -0800LanarkBy: thelonius
http://ask.metafilter.com/296465/Why-is-Numbers-the-spreadsheet-app-for-ios-doing-this#4295054
this is why most software that deals with money uses the integer 1 to mean 1 cent, not one dollar. No floating point math issues then.comment:ask.metafilter.com,2016:site.296465-4295054Wed, 01 Jun 2016 08:28:26 -0800theloniusBy: kitty teeth
http://ask.metafilter.com/296465/Why-is-Numbers-the-spreadsheet-app-for-ios-doing-this#4295290
Thanks, everyone! Problem solved!comment:ask.metafilter.com,2016:site.296465-4295290Wed, 01 Jun 2016 15:54:54 -0800kitty teeth