![]() |
HP50g Bug - Troubling - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: HP50g Bug - Troubling (/thread-140433.html) |
HP50g Bug - Troubling - MikeO - 09-04-2008 I believe I've found a bug on the HP50g, and I'm hoping others can confirm this. The calculator is in the following mode (non-approx mode): DEG XYZ HEX C= 'X' The program is entered into 'GSP' variable as follows (replace SQR with square root symbol): << -> V A W B << 'SQR(W^2+V^2-2*W*V*COS(180-B+A))' EVAL >> >> I enter the following values onto the stack and execute GSP: 4: 400 The calculator hangs. After a second or two, I press CANCEL, and the stack is filled with garbage. If I switch the calculator to approximate mode: DEG XYZ HEX C~ 'X'Then, the program returns a correct result: 396.48 I entered the same program into 'GS2' in full RPN-style (again, replace SQR with the square root symbol): << -> V A W B << 180 B - A + COS W * V * 2 * NEG V SQ + W SQ + SQR >> >> I can run this program in either approximate or exact modes without problems. It appears to be some sort of problem parsing the algebraic expression in the first program example; however, the problem didn't become apparent until I entered the exact test input above. If 180 - B + A = 45, the program crashes. I'm hoping someone can reproduce the problem.
Thanks,
Edited: 4 Sept 2008, 2:36 a.m.
Re: HP50g Bug - Troubling - Antonio Maschio (Italy) - 09-04-2008 Curious, it just happened to me too.
I tried with this slightly different set of input: 4: 400 getting 396.480852718, which I assume is the right result. ANy explanations? The problem seems to lie in the algebraic execution of COS.
-- Antonio
Re: HP50g Bug - Troubling - Marco Polo - 09-04-2008 Quite strange. Program runned on HP50g, rom 2.09, serial (sticker) CNA 715xxxxx.
Regards Re: HP50g Bug - Troubling - V-PN - 09-04-2008 49g+ ROM 2.09 and 48gII ROM 1.23
I have narrowed the bug down to
setting flag -125 avoids evaluation error
In the ALG mode it evaluates to:
THEN...after visiting the ALG mode
The original problem gives: Edited: 4 Sept 2008, 5:29 a.m.
Re: HP50g Bug - Troubling - Marco Polo - 09-04-2008 Ok. Re: HP50g Bug - Troubling - George Bailey (Bedford Falls) - 09-04-2008 The original ALG program runs for about 2 minutes and delivered the correct result on my 50G. But then I took out the SQR from the program. Like so:
<< -> V A W B << '(W^2+V^2-2*W*V*COS(180-B+A))' EVAL >> >> and pressed SQR after I had the result from the above program on the stack. Then ->NUM and got the right result. Much faster than 2 minutes. It will also work if I put the SQR back in after the ALG expression and EVAL. Like so:
<< -> V A W B << '(W^2+V^2-2*W*V*COS(180-B+A))' EVAL SQR >> >>
Edited: 4 Sept 2008, 10:56 a.m. after one or more responses were posted
Re: HP50g Bug - Troubling - MikeO - 09-04-2008 I have managed to narrow the expression causing the problem down to (replace SQR with the squareroot symbol): 'SQR(5^2+400^2-2*5*400*SQR2/2' If I enter this expression into the calculator and EVAL it, I get the same behaviour as the example program. The COS(180-B+45) expression evaluated to SQR2/2. On a hunch I simply put that back into the expression. So the problem is a little simpler now.
Thanks,
Edited: 4 Sept 2008, 10:58 a.m.
Re: HP50g Bug - Troubling - MikeO - 09-04-2008 Hi George, I have managed to narrow the expression causing the problem down to (replace SQR with the squareroot symbol): 'SQR(5^2+400^2-2*5*400*SQR2/2' If I enter this expression into the calculator and EVAL it, I get the same behaviour as the example program. Thanks! MikeO
Edited: 4 Sept 2008, 10:59 a.m.
Re: HP50g Bug - Troubling - George Bailey (Bedford Falls) - 09-04-2008 Hi MikeO, just edited my post above. Have you tried to leave the original program run for 2 minutes? Should show the correct result.
Regards, Re: HP50g Bug - Troubling - George Bailey (Bedford Falls) - 09-04-2008 Quote: Not so here. If I enter 'SQR(5^2+400^2-2*5*400*SQR2/2)' and press ->NUM I instantly get the right result.
Might really be some operator precedence issue. Edited: 4 Sept 2008, 11:10 a.m.
Re: HP50g Bug - Troubling - MikeO - 09-04-2008 I did, and it does eventually come back with an expression to evaluate. So, I guess the question is why does it take two minutes? We're probably looking at a CAS algorithm problem. Thanks,
MikeO
Re: HP50g Bug - Troubling - MikeO - 09-04-2008 George, DEG XYZ HEX C= 'X' Oh yes - to replicate the behavior I'm seeing, you have to enter the expression, then EVAL. It's the EVAL which is hanging up for so long. -MikeO
Edited: 4 Sept 2008, 11:21 a.m.
Re: HP50g Bug - Troubling - V-PN - 09-04-2008 Quote:
Ther is a bug in a sense: If you just let it finish, run for long enough time, about two minutes, it will be OK
Re: HP50g Bug - Troubling - MikeO - 09-05-2008 Thanks all for verifying this. Yes, it does eventually finish, just unexpectedly slow (2 minutes!). I guess that's a good reason to put the calculator on approximate mode when looking for numerical results. Thanks, MikeO
|