Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fenlyn

macrumors newbie
Original poster
Nov 10, 2003
27
0
Atlanta
Check out this attached file... paper tape can't add or subtract. Perhaps it needs a lesson in basic math.

Brad
 

Attachments

  • badcalc.jpg
    badcalc.jpg
    28.4 KB · Views: 1,582
No... I was figuring out my bills. I found it odd that the calculator display showed the correct answer to my addition and subtraction, but the paper tape is showing an incorrect answer. I never added or subtracted .00000000000001 when I was doing my bills. The fact that the paper tape is not capable of basic math is what I found amusing.

Called Apple about it today, and they said they hadn't even heard of the bug. The support person I was talking to was running 10.3, so I was able to demonstrate it to her. Bug doesn't appear in 10.2... seems like Calculator got a facelift for Panther.
 
It's typical of real (floating point) numbers on computers to be that inaccurate since real numbers cannot be simply described. Most floating point units use the IEEE-754 standard for describing and calculating real numbers but it is built more for scientific calculations.

In fact, most programming languages are incapable of handling money correctly. COBOL and RPG (II/III/IV) have proper types which can be specified with a fixed number of decimal positions that do not falter as do C, C++, Objective-C, Java, etc.
 
I thought it was just a VPC quirk but the same thing appeared in Virtual PC6.1 running Windows2000 under OSX10.3.

On the update it said it had to download something like 15.000000000001 MB

I wonder if there is a problem in OSX?

-Wyrm
 
Originally posted by Wyrm
I wonder if there is a problem in OSX?

-Wyrm

Nope, this is a common problem with trying to do decimal arithmetic in binary.

Try representing 0.1 in binary and you'll see the problem.

Better yet, try doing all your math in base 'e'.

Most programs round so you don't notice it, but the inaccuracy is in most programs. If they try to show too many sig figs it will show.
 
Think yourself lucky... anyone remember when the Windows 95 calculator used to do this:

1.01 - 1 = 0.0

Pretty big rounding error if you ask me!

:D
 
i remember this coming up some time ago. not complaining about a dup thread, 'cause this was a looong time ago, just agreeing that it's not a new issue.

pnw
 
Originally posted by steadyeddie
Think yourself lucky... anyone remember when the Windows 95 calculator used to do this:

1.01 - 1 = 0.0

Pretty big rounding error if you ask me!

:D

I remember the original Pentium processor had a big error with its math co-processor which led to all kinds of quirks when the first Pentiums came out with Windows 95.
 
Originally posted by Powerbook G5
I remember the original Pentium processor had a big error with its math co-processor which led to all kinds of quirks when the first Pentiums came out with Windows 95.

Right. Most compilers for x86 code generation include a flag to tell the compiler to create FDIV instruction code that is Pentium safe. It was only the first 500 processors but then, the 486s and 386s had divide problems too.
 
Calc error

I just got off the phone with Mac tech support, it seems this is a more common error than I assumed at first. I have a G5 which can't do basic math (and this is in the calculator display, not the tape) but the tech I talked to repeated the problem on a G3 iMac. Seems like a shame that I spent about 4 grand on a computer and now I'll have to spend another $30 on a desktop calculator so I can balance my checkbook. The tech referred me to an article that basically reads "Sorry about your luck", it seems that Apple doesn't find the calculator important enough to fix. BTW, I downloaded two freeware calc apps and both had the same problem so this is a Mac problem in general, not the application. I am at a loss as to why the beast of Redmond can make a working calc program but Apple is clueless. It seems to me that if Apple can't make a working calculator they should leave the app out entirely.
 

Attachments

  • calc.jpg
    calc.jpg
    15.5 KB · Views: 687
Re: Calc error

Originally posted by crash_harddrive
I just got off the phone with Mac tech support, it seems this is a more common error than I assumed at first. I have a G5 which can't do basic math (and this is in the calculator display, not the tape) but the tech I talked to repeated the problem on a G3 iMac. Seems like a shame that I spent about 4 grand on a computer and now I'll have to spend another $30 on a desktop calculator so I can balance my checkbook. The tech referred me to an article that basically reads "Sorry about your luck", it seems that Apple doesn't find the calculator important enough to fix. BTW, I downloaded two freeware calc apps and both had the same problem so this is a Mac problem in general, not the application. I am at a loss as to why the beast of Redmond can make a working calc program but Apple is clueless. It seems to me that if Apple can't make a working calculator they should leave the app out entirely.
As stated, this is a problem with floating point arithmetic. Any calculator program I have made in C++ I have always put error checks in, which isn't that difficult. Also, I believe the reason that you notice in on windowsupdate with Windows under VPC is because of the floating point arithmetic while converting from x86 to PPC. I don't know much about the PPC architecture (new to Macs), but I am also wondering why this seems to be more prevalent in the Mac calculator programs. Are the programmers just lazy in putting in checks for this, or is this an inherent inadequacy of the PPC architecture?
 
Some good experience.

I'm running in 10.2.8.
Problem in "Calculator" shared.
"TopCalculette Pro U-3.5" works fine even with paper tape.
Besides, "Graphing Calculator 1.3" in Classic mode also works though there is no traditional paper tape.

;)
 
I tried doing the same exact calculations and it did them fine. I am using version 3.1.
 
Originally posted by Vector
I tried doing the same exact calculations and it did them fine. I am using version 3.1.

Turn on the paper tape, and do the original calculations. It gives the floating point error shown. I am running 3.1 also.
 
I get this error too in Calculator 3.1, I'm running a G4. I tried the same thing in a Ti-81 emulator but its decimal places doesn't go that far.
 
I am surprised that Apple let this through; although this is a common problem in binary arithmetic it's usually handled by taking care of significant digits.

I've now seen the binary precision issue in the regular calculator display. Since it was a completely innocent example (I was doing real math, not trying to break the calculator) I have to believe it will be a regular ocurrence.

Of course, this being OSX, I just avoid it by using xcalc :)
 
well that happens because the precision is set to 12 digits..just goto view-precision and set it to 2..viola it works again...i dont get how this can be considered a bug?!!
 
Originally posted by abhishekit
well that happens because the precision is set to 12 digits..just goto view-precision and set it to 2..viola it works again...i dont get how this can be considered a bug?!!

I take it you have never programmed a something that did floating point arithmetic. It's a bug because that's not what the answer is. Do it in your head, on paper, with a handheld calculator, and you will see it is wrong. When doing floating point arithmetic, a lot of casting goes on, so there are inevitable mistakes. Most programmers will take the time to put something in to prevent or catch something like this from happening. Setting the precision to two will only cover it up, not fix it.
 
Originally posted by NuPowerbook
I take it you have never programmed a something that did floating point arithmetic. It's a bug because that's not what the answer is. Do it in your head, on paper, with a handheld calculator, and you will see it is wrong. When doing floating point arithmetic, a lot of casting goes on, so there are inevitable mistakes. Most programmers will take the time to put something in to prevent or catch something like this from happening. Setting the precision to two will only cover it up, not fix it.

yah..never...but anyways i think the guy who started the thread was looking to use the cal and not invent it...
 
Originally posted by abhishekit
yah..never...but anyways i think the guy who started the thread was looking to use the cal and not invent it...

I know, but you said it isn't a bug, when it clearly is. I was just explaining why it is a bug.
 
Originally posted by abhishekit
well that happens because the precision is set to 12 digits..just goto view-precision and set it to 2..viola it works again...i dont get how this can be considered a bug?!!

Floating point math and money really don't mix well, so I'd call it a dubious design choice on Apple's part.

The problem they would have been trying to avoid is that doing arithmetic the same way we would do it by hand (in decimal, and really working with arbitrary length integers -- the decimal point is just a place marker) can be slow for computers to simulate.

On the other hand, a calculator is a perfect candidate for "bigint" math in the REXX tradition, since it's interactive and those delays would go unnoticed.

edit: How to do it right
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.