Omnimaga

Calculator Community => Other Calculators => Topic started by: thepenguin77 on November 08, 2012, 11:29:26 pm

Title: More Precision on the 83+/84+ (10^127 - 10^-127)
Post by: thepenguin77 on November 08, 2012, 11:29:26 pm
Did you know that placing the maximum exponent at 10^99 was a completely arbitrary move by TI? In any case, I did, and I got rid of that limitation.

With this OS patch, your calculator can handle exponents from E-127 to E127.

(http://img.removedfromgame.com/imgs/more_precision.gif)

I'm going to guess that TI added this limitation to keep up with their older calculators which only had room for a two digit number. They also probably kept it at two digits because they used a nice little hack to parse the numbers after the E token. But, in any case, I took off the bounds checking so that large numbers don't throw an ERR:OVERFLOW and modified the number parser to allow 3 digit numbers.

I made a patch for 1.19, 2.43, 2.53, and 2.55. The 2.55 is the ugliest of them all as I had to locate some code on page 00 (which could potentially mean compatibility issues with other patches), but they all work.


If you understand how TI-floats work, you might be wondering why I didn't allow E-128, and the reason for this is that there's a certain routine which could underflow back to E127, and that would just cause weird issues that I don't want to deal with. So E-127 is the limit.

I included the patcher with it's patch files if you want to see what is going on.

Edit:
    And like always, there's an option to undo the patch. ;D
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: Sorunome on November 08, 2012, 11:32:44 pm
wow, that is awesome!
So that program patches the os and afterwards i can delete it again? epic! :D
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: Builderboy on November 08, 2012, 11:39:41 pm
That doesn't sounds like more precision at all!  That sounds like a larger range with the same amount of precision :P
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: Sorunome on November 08, 2012, 11:40:16 pm
BTW, just tested and it is awesome!
While patching, what do the letters in the lower left corner mean? :P
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: thepenguin77 on November 08, 2012, 11:46:52 pm
That doesn't sounds like more precision at all!  That sounds like a larger range with the same amount of precision :P

Yeah, I totally realize that. But I don't know what else to call it.
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: Hayleia on November 09, 2012, 02:28:38 am
I just tried it on my 84+SE, it is great :D
Is there a way to make it work on the 83+ too ?
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: calc84maniac on November 09, 2012, 02:30:35 am
I just tried it on my 84+SE, it is great :D
Is there a way to make it work on the 83+ too ?
He mentioned the patch works on OS 1.19, so I assume that means TI-83+ is supported.
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: Hayleia on November 09, 2012, 02:31:48 am
I just tried it on my 84+SE, it is great :D
Is there a way to make it work on the 83+ too ?
He mentioned the patch works on OS 1.19, so I assume that means TI-83+ is supported.
That is what I thought too but I didn't want to be the one that crashed a calc for more precision :P
And the title only mentions the 84+ so I really had doubts.
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: aeTIos on November 09, 2012, 03:54:17 am
Woo, thepenguin strikes again :D
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: Juju on November 09, 2012, 08:49:20 am
Yeah, I knew about this a while ago while messing up with Calcsys and changing the exponent part of a variable to higher than 99 and it worked :P The mantissa part is in BCD, so if you manage to increase the size of the mantissa field you would indeed get more precision. And if you increase the size of the exponent field, you would get numbers up to 10^65535. As always, nice OS patch.
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: Xeda112358 on November 09, 2012, 08:55:08 am
Yay, now it works like some of the older calcs I saw :D I think a friend of mine had a TI-86 or TI-85 that could use numbers up to 10^127.
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: Juju on November 09, 2012, 08:57:16 am
I think the TI-89 was also similarly constrained, as in only allowing numbers up to 10^999. Unless they use BCD for the exponent, it probably goes up to 1023.
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: Lionel Debroux on November 09, 2012, 09:10:38 am
The TI-68k series uses binary for the exponent, BCD for the mantissa. Exponents can go between -16383 to +16382, but most math functions don't like exponents below -999 or above +999.
( http://debrouxl.github.com/gcc4ti/timath.html#bcd )
Title: Re: More Precision on the 84+ (10^127 - 10^-127)
Post by: Yeong on November 09, 2012, 09:30:45 am
Thank you penguin. You did a great job yet again.
Title: Re: More Precision on the 83+/84+ (10^127 - 10^-127)
Post by: Adriweb on November 09, 2012, 03:36:09 pm
Btw, I showed this topic to a TI employee (a z80 master :P) and he said it's awesome ;) (or, well, at least talking about all of us here : "Those guys are awesome") :D
Title: Re: More Precision on the 83+/84+ (10^127 - 10^-127)
Post by: aeTIos on November 09, 2012, 03:39:10 pm
Hehe :D viva les z80 guys :D They are the guys that understand how we feel.
Title: Re: More Precision on the 83+/84+ (10^127 - 10^-127)
Post by: DrDnar on November 09, 2012, 04:44:06 pm
I'd noticed that the restriction was arbitrary, but I never considered hacking the OS to remove it. Your understanding of the EOS amazes me.
Title: Re: More Precision on the 83+/84+ (10^127 - 10^-127)
Post by: thepenguin77 on November 09, 2012, 08:52:45 pm
I'd noticed that the restriction was arbitrary, but I never considered hacking the OS to remove it. Your understanding of the EOS amazes me.

It wasn't really all that difficult to do since like you said, I knew it was arbitrary.

The first step was to prevent ERR:OVERFLOW. For this, I did 1E99 + 9E99 and set a break point at _FPAdd. From there, I just stepped through the code and waited for an ERR:OVERFLOW to be thrown. After about 3 iterations of this, I finally stumbled upon _CkValidNum which clearly compared the exponent to +99 and -99. I just disabled that check :P (Actually, I still check for E-128)

The second step was to allow 3 digit exponents, but again, this was just a bit of "find the error." I set a breakpoint in the massive parser loop (endless "CP \ jr z" table) and watched as the errors unfolded for E127. I soon found a routine that used RLD to rotate the low nibble of the current byte being parsed into memory and I saw that on the third iteration, the memory location became invalid and a counter went to zero. My solution for this was just to do some code injection where I put a call to the end of the page and wrote my own routine to parse the number. All I had to do was watch for the overflow and add $A0 (BCD hack) if the new exponent was going to be in the correct 100-127 range and increase the counter by 1 to avoid the error.


So I guess that's a bit complicated, but the idea is that if something throws an exception, it's not very hard to catch by stepping through the code.
Title: Re: More Precision on the 83+/84+ (10^127 - 10^-127)
Post by: squidgetx on November 09, 2012, 10:17:21 pm
Nice work penguin.

I don't have much else to say. Although the explanation of how you tracked it down is pretty cool and useful as well. Good job.
Title: Re: More Precision on the 83+/84+ (10^127 - 10^-127)
Post by: ralphdspam on November 09, 2012, 11:47:18 pm
Wow!  This is amazing!

It always annoys me when they place arbitrary restrictions in their OS.
Title: Re: More Precision on the 83+/84+ (10^127 - 10^-127)
Post by: calcdude84se on November 12, 2012, 12:49:36 am
Some routines seem to like to check that their argument is in the old bounds. For example, sqrt(E100) works, but trying E100^.5 fails with ERR:OVERFLOW.
Title: Re: More Precision on the 83+/84+ (10^127 - 10^-127)
Post by: Hot_Dog on November 12, 2012, 06:46:34 am
ThePenguin77, you never cease to amaze me :)