WP 34S and 31S bugs and fixes
|
11-26-2014, 05:24 AM
(This post was last modified: 11-26-2014 05:28 AM by Bit.)
Post: #10
|
|||
|
|||
RE: WP 34S and 31S bugs and fixes
I've found another issue related to prime numbers. NEXTP increments a number in a loop but if the value is large enough, there aren't enough digits in the mantissa for the number to actually increase. For X ≥ 263, the recently fixed PRIME? command produces an error. But in single precision mode if 9999999999999937 ≤ X < 263, the XROM code gets stuck in an infinite loop and the calculator has to be reset.
I've updated NEXTP, and now it gives a domain error instead of hanging in such cases. If it's invoked in single precision mode (or on the 31S), it fails if the input is greater than or equal to 9999999999999937 (the largest prime that can be accurately represented in single precision mode). Without that, it'd produce incorrectly rounded values when returning from double precision mode via xOUT. For example, NEXTP 1017 would return 1017, which is neither the next number, nor a prime. The new version uses xIN that helps properly recover from errors reported by PRIME? and handle truncating in integer mode. The only library function that invokes NEXTP is PF, which doesn't use xIN, so there are no conflicts due to nesting. This issue highlighted another problem: XROM code couldn't be interrupted. Other similar bugs in XROM may exist or could be introduced later, so it'd be useful if there was a more graceful way of dealing with them than a hardware reset. Therefore I created a feature to interrupt XROM code safely by holding down the EXIT/ON key for a while. A variable (OnKeyTicks) in volatile RAM indicates how long the EXIT key has been held down and xeq() generates an error ("Interrupted") above a certain threshold. It's a compile time option and I recommend that it be enabled in all builds, but I left it disabled by default until it's approved by one of the original developers. Pascal, I've added support for this feature in the Qt versions. They seem to work on Linux but please have a look. To make testing easier for those who can't compile binaries, I've attached 34S and 31S builds that interrupt XROM code if the EXIT key is held down for 1 second, and they include the old NEXTP implementation that locks up if X = 1017 in single precision mode. (The binaries were compiled from vanilla r3700 sources without any of my other patches.) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)