[HP 35s] Hosoda's trig program affected by bug 20?

07242015, 11:10 AM
(This post was last modified: 07242015 11:19 AM by Marcio.)
Post: #1




[HP 35s] Hosoda's trig program affected by bug 20?
Hello all,
While playing with program based functions on the 35s, I noticed that the solver will never finish if Hosoda's program for trig functions is called from inside functions. Hosoda does make use of DSE at the beginning to save the stack registers, so I suspect 20 bug is to blame here. For example, if you use Hosoda, try solving \(sin(x)=1\) for \(x\). This is how I did it: F001 LBL F F002 RCL X F003 XEQ H001; F004 1 F005  F006 RTN FN = F 80 \(\rightarrow\)RAD STO X Solve for X. For those unfamiliar with Hosoda's program, it is a nice addition to the 35s to compensate for the loss of accuracy when trig functions are used, especially in cases where the angle is very small (~1E7) or near 90 degrees. Our dear friend Gerald added a few enhancements to it and published the final code here. Very much appreciated. Marcio 

07242015, 11:19 AM
Post: #2




RE: [HP 35s] Hosoda's trig program affected by bug 20?
If you substitute 0.5 for 1 in your programme the solver evaluation does finish.
"Enhancements" is the wrong word  I merely completed the two missing lines. 

07242015, 11:34 AM
Post: #3




RE: [HP 35s] Hosoda's trig program affected by bug 20?  
07242015, 11:49 AM
Post: #4




RE: [HP 35s] Hosoda's trig program affected by bug 20?
Sorry, my error.
Given initial value P= 0.8 after 3 minutes of evaluation the value of P was the same, so I guess the solver bug applies OR the programme messes with the solver in some way. 

07292015, 01:42 PM
(This post was last modified: 07292015 04:08 PM by Marcio.)
Post: #5




RE: [HP 35s] Hosoda's trig program affected by bug 20?
Update:
The same will happen if you try to integrate a program. 

07292015, 06:56 PM
Post: #6




RE: [HP 35s] Hosoda's trig program affected by bug 20?
(07242015 11:10 AM)Marcio Wrote: Hosoda does make use of DSE at the beginning to save the stack registers, so I suspect 20 bug is to blame here. If that's the only reason that the solver fails then you could use a loopunrolling: Code: J004 X<> 00 Code: J015 RPN I must admit that I don't understand the following lines: Code: J018 4 Why do we need the value 4 in register 04? But I've noticed this line: Code: J066 ISG J This might still lead to a problem when using the solver. Kind regards Thomas 

07292015, 07:21 PM
(This post was last modified: 07292015 07:32 PM by Dieter.)
Post: #7




RE: [HP 35s] Hosoda's trig program affected by bug 20?
(07292015 06:56 PM)Thomas Klemm Wrote: If that's the only reason that the solver fails then you could use a loopunrolling: The 35s does not use direct numeric registers like the classic calculators. It uses 26 lettered variables A...Z instead. These can be accessed indirectly by negative (!) addresses, i.e. A is –1, B is –2 etc. Of course your idea can be implemented by replacing R00...R03 with A...D – or X, Y, Z and T, if you like. The Hosoda program uses positive addresses instead. These refer to the 800+ indirect registers of the 35s. So a STO (I) with I=3 stores a value in register (003). I assume this was the preferred solution because this way the program does not interfere with the regular variables A...Z that can be accessed directly by the user. (07292015 06:56 PM)Thomas Klemm Wrote: I must admit that I don't understand the following lines: I think the author wanted to make sure that at least four indirect registers are allocated. On the 35s this is done by storing a nonzero value in the highest register (here (004). Since the values on the stack may be zero, explicitly storing a nonzero number (here: 4) there (resp. the first one beyond it) makes sure that registers up to (004) are allocated. Finally (000)...(003) hold the original stack, and (004) contains a 4, which merely tells the 35s to allocate sufficient memory. Dieter 

07292015, 07:52 PM
Post: #8




RE: [HP 35s] Hosoda's trig program affected by bug 20?
Thanks for your answers. I forgot so many things about this calculator. Which proves that I don't use it often.
Cheers Thomas 

« Next Oldest  Next Newest »

User(s) browsing this thread: