Bug in Calculator App?

sevoneone

macrumors 6502
Original poster
May 16, 2010
496
410
This is very random, but I just stumbled on this by accident: If you ask the calculator app to calculate 10^23 (10 to the power of 23) it returns 9.9999999999e22 instead of 1e23. It seems to only do this for 10^23, every other power I tried returns correctly. I'm running 10.14.6, but I tested and got the same results on Macs running 10.12.6 and 10.15.3. It seems this little error has been around for awhile. Now I'm curious, is this an uncaught bug, or is there some reason the app can't calculate 10^23?

Also strange, if I type 10^23 into spotlight, I get the correct result.
 

organicCPU

macrumors 6502a
Aug 8, 2016
666
182
Spotlight is probably sending the query to Google hence the correct result.
No, Spotlight is able to calculate offline, too! By the way, Apple has been started partnering with Microsoft and Bing for searches years ago and quit partnership with google.
It's a bug.
Maybe you're right.

Spotlight seems to round integers starting from 16 digits decimal numbers. That limitation is leading to scientific E notation rounded to 14 post decimal positions, while 15 would be needed for exact results. -> Try to calculate in Spotlight: 1000000000000000 + 1 (or more).

Calculator app seems to deal with integer a little different. Provided the scientific calculator is set to 15 post decimal positions, integers whose binary length is 53 bits or more, seem to round in a way that behave like bugs. -> Try to add 1 to 9007199254740992 or multiply or divide 9007199254740993 by 1.

Calculator app shows another strange behavior, if typing an integer like 999999999 in scientific calculator, then switching to programming calculator, then just switch back to scientific calculator and subtract 1.

If you check out these examples and consider that the OP's question refers to a much larger integer with 24 digits or 77 bits in binary notation, I'm not wondering about Calculator app being unable to output a precise scientific E notation of 1e23.

However, I think all this could be explained by floating-point arithmetic by some clever Apple or Intel tech staff. Could someone try to calculate this on an ARM driven iOS device? Meanwhile the rest of us is calculating just with smaller numbers or is running third-party calculators, but these might be features, not bugs. ;)
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.