Post Reply 
[WP 34S] Enhanced Y register display: fractions, bugfixes etc.
02-12-2014, 06:02 AM
Post: #29
RE: [WP 34S] Enhanced Y register display: fractions, bugfixes etc.
(02-11-2014 07:59 PM)Paul Dale Wrote:  I did think about trying to do this faster but so much depends on display modes and the widths of the characters themselves. 11111 takes less pixels than 88888 e.g. The brute force solution seemed easiest and it is very small. A binary search approach might work better, still cover the entire range and require fewer iterations -- start at the mid-point and ask does this fit? If not halve the digit count, if so double it and try again.
The brute force solution was apparently good enough so far. Even with Y register display I don't think this particular issue is the worst bottleneck but it was an obvious one to optimize.

What I did is very simple:
1. If the number of digits actually produced is fewer than requested, the iteration switches to that number instantly because there's no point in trying the intermediate values. There's no need to count anything: set_x_dn() already keeps track of the number of digits used, I just made it return that value to annunciators().
2. The number of requested digits is further reduced in each iteration by a value calculated from the number of pixels by which we went beyond the 43 pixel limit.
The worst case I've seen is 4 iterations (vs. 10 in the original code) and it's usually only 2.

I'll put the code in SVN once a final decision has been made about how to organize it (please see the private message). If you can create a better version using binary search, I'd be interested to see it.

(02-11-2014 07:59 PM)Paul Dale Wrote:  The press and hold to display the function which then nulls out might confound things here.
Those cases should be handled correctly because only data entry operations are affected, functions aren't. I wouldn't be surprised if there were still some problems to sort out as I haven't had much time to test this latest version, so please report the bugs. Smile
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: [WP 34S] Enhanced Y register display: fractions, bugfixes etc. - Bit - 02-12-2014 06:02 AM

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