Post Reply 
Finding the number of digits on the iPhone Calculator
11-22-2019, 04:06 PM
Post: #1
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
Find all posts by this user
Quote this message in a reply
11-22-2019, 05:47 PM (This post was last modified: 11-22-2019 08:22 PM by Albert Chan.)
Post: #2
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
Find all posts by this user
Quote this message in a reply
11-22-2019, 06:36 PM
Post: #3
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 Smile

Software Failure: Guru Meditation

--
Antonio
IU2KIY
Find all posts by this user
Quote this message in a reply
Post Reply 




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