HP Forums
Finding the number of digits on the iPhone Calculator - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not remotely HP Calculators (/forum-9.html)
+--- Thread: Finding the number of digits on the iPhone Calculator (/thread-14033.html)



Finding the number of digits on the iPhone Calculator - TheKaneB - 11-22-2019 04:06 PM

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!


RE: Finding the number of digits on the iPhone Calculator - Albert Chan - 11-22-2019 05:47 PM

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


RE: Finding the number of digits on the iPhone Calculator - TheKaneB - 11-22-2019 06:36 PM

nice trick, thank you!

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