HUGE UPDATE

SEE LAST POST

I was wondering for a while how to make there be more decimal precision on my calc.

So, I asked Kerm where the Fix/Float settings were and if they could go past 9. Thus, this topic exists.
Here's your answers:
- The number of Fix digits is stored at fmtDigits (97B0h), which I found in BrandonW's include file after I figured it out by hand. It's an 8-bit number directly corresponding to the Fix value
- The Float/Fix flag is also 97B0h. It assume the value -1 (0xFF) when you're in Float mode.
This did not work. Maybe a hook or OS patch is needed.
I have to go do more studying, so bye!
parrotgeek1 wrote:
This did not work. Maybe a hook or OS patch is needed.
I have to go do more studying, so bye!
Yes, I'd assume that it simply doesn't have the capability to display more than 9 digits after the decimal point.
The calc does have 14 significant digits!

Proof:

Code:
Prompt X
{0,1}->L1
{X,X}->L2
LinReg(ax+b) L1,L2,Y0
Equ>String(Y0,Str0)
sub(Str0,4,length(Str0)-3)->Str0
Disp Str0
Yes, internally it stores 14 significant figures. But it doesn't seem that the homescreen display routines via Fix have access to more than 9 digits after the decimal point.
I was thinking I could use a homescreen hook: WikiTI link

Quote:
These different values, passed in A, determine what the hook should do.
0: The calculator is displaying a result.
OP1 = the value to display
You can change the value in OP1 to display something different, which will not affect the value stored to Ans.
If you want to display something wider than the screen, you must also write the formatted string to fmtString.
Return NZ and TIOS will not display anything.

So, I could just use my own display routine? or make it a string.
But if I made it a string, you couldn't copy-paste it.

Any suggestions?
Well... I was programming with Mimas again, and I didn't have any documentation (my mom said I would have to pay for all paper and ink for the rest of the year if I printed out the 83psysroutines.pdf Razz) Also, it's to big.

I used DispOP1a with accidentally A was 1, and OP1 was like 5 digits! Of course there was ERR:overflow and I hit quit. I kept trying to figure out why it was happening, (and leaked tons of RAM from the system error handler). Then I actually had to use my calc. for something math, and I noticed that it was showing 14 digits on the home screen! I have been able to replicate this on 3 calculators, a total of 11 times. (Even 83+)

The shortest code that does this is:

Code:
.org progStart - 2
.db $BB, $6D

ld a, 99
bcall SetXXOP1
ld hl, myErrorThingy
call app_push_errorh
ld a, 1
bcall DispOP1a
call app_pop_errorh

myErrorThingy:
ret


It seems to go away the next time DispOP1a is called (I think), i.e. Trace, Text( etc. Also Fix/Float settings don't work.

My question is, what does this end up (unintentionally) doing? How can I do it in a less weird way? Also, can I change the number of digits? (later)

A picture:
Interesting. It seems that when DispOP1A (or to be more precise, FormReal) throws an error, the fmtEdit flag is left set, which causes the number formatting routines to ignore the format settings and simply display the maximum allowed number of digits, omitting trailing zeroes. (That flag is set by FormEReal and would normally be cleared when FormEReal finishes.)

(So if you want to enable this behavior, you can simply set the fmtEdit flag yourself. But as you note, it'll be reset whenever FormEReal is called.)

You can't control how many digits it will give you in this case, it's hardcoded in the OS. Interestingly, though, it seems the limit is 12 digits for real numbers, but 14 digits for complex numbers. Also, real numbers displayed on the homescreen (or by FormDisp) are still limited to 14 total characters.
FloppusMaximus wrote:
Interesting.

Achievement unlocked: an assembly guru/god found my question interesting!
Quote:
You can't control how many digits it will give you in this case, it's hardcoded in the OS. Interestingly, though, it seems the limit is 12 digits for real numbers, but 14 digits for complex numbers. Also, real numbers displayed on the homescreen (or by FormDisp) are still limited to 14 total characters.

Strange.
Also if you set fmtDigits to anything more than 9 it just acts like it's 9.
__________________________

EDIT: I have been investigating more, and this ENTIRE thing is most likely caused by BCALL RndGuard. Make an OS patch to change it to round to whatever number of digits you want (<13), and boom!

It would work especially well with thepenguin77's Exponents -127 to 128 thing. But this would cause some issues in, e.g. basic programs that assume a number can only be 10 characters wide.

about the below: help! what about imaginary numbers, matrices, strings, etc.???
also scientific, re^0i, stuff!


Another, less intrusive way I have been thinking is to use a homescreen hook in an app. I would use

Code:

add a,e           ; Required for all hooks
cp 0               ; is it display value condition?
jr nz,ret_z
ld a, (fmtDigits)
cp $FF
jr nz, ret_z ; do nothing in fix mode
ld a,12 ; max 12 characters says BrandonW
bcall FormEReal
ld hl, OP3
ld (fmtString),hl
; " If you want to display something wider than the screen, you must also write the formatted string to fmtString. " WikiTI

ret_z:
ret z

Tell me if you find any problems with this, And yes I do know how to make/enable a hook. (The thing I always forget is in a,(6).)

Also, in using this, I have noticed some bugs:

    With MathPrint on, sometimes it will let me scroll "infinitely" past the end of the result. (also seen occasionally before this, but nowhere near as often)
    Also with MathPrint complex numbers like to randomly (not lately...) start truncating themselves to 20 characters. (Whaaaat...?)
    Numbers in scientific notation are still 10 digits.
    The thing about Output( I said earlier.
    pi seems to be only 3.14159265359 i.e. one digit shorter than anything else. (This is a weird one)

    Not exactly bugs (ideas):
    hook w/round( err:domain "fix"
    disable in basic progs?
    also Fix command higher #s hook


Apologies for the long-winded post...lol
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement