![]() |
Possible bug with sqrt function in the HP prime - 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: Possible bug with sqrt function in the HP prime (/thread-255833.html) |
Possible bug with sqrt function in the HP prime - Michael de Estrada - 11-15-2013 I say "possible" bug in the title, because this may just be another case of me not understanding the subtleties of this calculator. I have found that if I pass a dummy variable x to a program and use it with sqrt(x), then I get a program halt with Error: wrong argument type. However, if I express it as v X, v(x), x^.5 or (x)^.5, where v is the square root symbol, then it works fine. I have no problems using other built-in functions such as SIN(x). I do not declare the variable as LOCAL in the program, as this causes it to evaluate to zero, regardless of the value passed to the program. EXPORT Test(x) BEGIN X:=sqrt(x); //this fails with wrong argument type X:=v x; //this works fine X:=x^.5; //this also works fine X:=SIN(x); //this also works fine RETURN x,X; END;
Edited: 15 Nov 2013, 11:59 a.m. after one or more responses were posted
Re: Possible bug with sqrt function in the HP prime - Tim Wessman - 11-15-2013 Square root symbol? Or the word spelled out "sqrt"?
Re: Possible bug with sqrt function in the HP prime - Michael de Estrada - 11-15-2013 The square root symbol as inserted by the shift x^2 key and the expression sqrt() as inserted from the catalog.
Re: Possible bug with sqrt function in the HP prime - Tim Wessman - 11-15-2013 Ah. You are storing into real variable X. If you just return your sqrt(x), what do you see? (sqrt is a CAS command btw)
TW Edited: 15 Nov 2013, 12:03 p.m.
Re: Possible bug with sqrt function in the HP prime - Michael de Estrada - 11-15-2013 Yeah, it works now. I guess I should have realized that it was a CAS command, since it is lower case letters. I also see that X:=CAS.sqrt(x) works or CAS("X:=sqrt(x)")
Edited: 15 Nov 2013, 12:30 p.m.
Re: Possible bug with sqrt function in the HP prime - Tim Wessman - 11-15-2013 As would EVAL(sqrt(x)) I suspect. The issue is trying to store a symbolic into a real only variable.
TW
Re: Possible bug with sqrt function in the HP prime - Michael de Estrada - 11-15-2013 What I find very confusing is that if I'm in CAS and select and enter sqrt from the catalog it displays as sqrt() on the command line, but once I enter it as sqrt(x), it becomes v x. If I do the same with sqrt(X) in Home it becomes sqrt(X) on the input side of the history. Edited: 15 Nov 2013, 12:49 p.m.
|