HP Forums

Full Version: Finding the number of digits on the iPhone Calculator
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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!
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
nice trick, thank you!

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