BUG: integer value rounds up during numeric entry

Things that aren't right, that are in the queue to be fixed... along with workarounds.
Post Reply
Posts: 240
Joined: Mon Aug 04, 2008 8:58 pm

BUG: integer value rounds up during numeric entry

Post by theDev » Tue Mar 08, 2011 6:20 pm

A bug was brought to my attention yesterday (7 March) that has been fixed and uploaded to Apple for approval. What happens is:

---the calculator is set to show (for example) 2 decimal places
---you enter 4.99, all is good
---you enter 5, to make the number 4.995 and [bug] the display suddenly changes to 5.995
---you press ENTER, and the display (correctly) shows 5.00.

What happened: the long winded answer is that way back in the iPhone 1 days when the calculator was originally written, there were problems with how the phone handled international formatting of numbers meant to be displayed as text--it would insert invisible padding characters. This required a workaround where the decimal portion was stripped of its padding characters and "pasted" back into the display BUT the integer value, doing as it should, rounded up. So the display wanted to show 5.00 but I went and stuffed the .995 back on in the display... bad move.

The "good" thing is that I don't use the display for calculations, so the calculator is still operating on 4.995. What you see in the display is a text representation of the numbers in the x register and my bug is that the text representation got messed up by me patching the text representation.

The fix is to not allow the text representation to be rounded until you are finished keying in numbers. That code was uploaded to Apple March 7 (yesterday) and should be released in the next few days.

(the release also adds copy and paste...)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest