Finding the number of digits on the iPhone Calculator
11-22-2019, 04:06 PM
Post: #1
 TheKaneB Member Posts: 175 Joined: Jul 2014
Finding the number of digits on the iPhone Calculator
Hi,
I'm trying to figure out the number of internal digits used in the iPhone standard Calculator App but I'm not sure I'm doing it right.
By calculating 1/3 and removing all the visible digits I start seeing weird results after the 20th digit or so. I guess it's an artifact caused by the binary representation? Is there a way to infer the exact number of binary digits used? I guess it's 64 bits but I want to be able to test my guess.

Any help appreciated!
Thanks!

Software Failure: Guru Meditation

--
Antonio
IU2KIY
11-22-2019, 05:47 PM (This post was last modified: 11-22-2019 08:22 PM by Albert Chan.)
Post: #2
 Albert Chan Senior Member Posts: 2,356 Joined: Jul 2018
RE: Finding the number of digits on the iPhone Calculator
Try to find eps, such that eps + 1 - 1 = 0

For example, my ipad Sci:Pro Calc apps has 128 bits precision

Code:
2 ^ -127 + 1 - 1 = 5.877471754111438e-39 2 ^ -128 + 1 - 1 = 0

Update: it is safer to double check around found eps, since 1+eps is a half-way case.
3e-39 + 1 - 1 → 5.877471754111438e-39
2e-39 + 1 - 1 → 0
11-22-2019, 06:36 PM
Post: #3
 TheKaneB Member Posts: 175 Joined: Jul 2014
RE: Finding the number of digits on the iPhone Calculator
nice trick, thank you!

Using this method it turns out it's 64 bit precision

Software Failure: Guru Meditation

--
Antonio
IU2KIY
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)