HP 42s square/nth root


Does anyone have a quick solution for "square and/or nth root" with the HP 42s. Do I have to write a short Programm for this?


Oh I'm already waiting soo long for an HP 42s replacement, how long will I have to wait for it, if it will be similar to the delays of the 33s ;-)


I'm not sure what you are looking for but would it be to take the cubic root of nine the.

9 enter
3 1/x and

Did that do it or are you looking for something else.



sorry, in my hurry I wrote square instead of cube..

Im searching for the function "x root y" which isn't on the 42s. It should take the nth root of a number, like "3rd root of 27 would equal 3".


In most HP calculators, there is no nth root key. Since obtaining the nth root is the same than applying the inverse of the nth power, you apply the already described sequence...

To get the P-th root of Q you should key:

value of Q


value of P



For example, "the fourth root of 16" is the same than "16 at the 1/4 power"




1/X (result: 0.25)

Y^X (result: 2 q.e.d.)


Thank's, Kim and Andrés - that's all i wanted to know :-).

So the missing key shows how little some people (like me) know about math ;-) ..and I found it finally in the original manual, too ;-)

I would prefer not seeing that key on a new layout now as i know how to do it without, so the keyboard stays clearer.

Same thing with the x^2 key on my HP 42s. could also press enter * , the only advantage is the saving of the t-Stack wenn using x^2.

Edited: 31 Jan 2004, 12:08 p.m.


You are welcome!


Robin posted --

"I would prefer not seeing that key [y^(1/x) key] on a new layout now as i know how to do it without, so the keyboard stays clearer."

One advantage of the special key for "root" exponents is that real-valued odd-integer roots of negative numbers can be found directly. For example, on a 32Sii,

(-8)^(1/3) using the "x-th root of y" function gives -2.000 as the answer.

However, using 1/x, then y^x on any calculator to find a real-valued result will give an error message, because

(-8)^(1/3) = exp{ln[(-8)^(1/3)]} = exp[1/3*ln(-8)] 

which is undefined due to "ln" of negative argument.

In complex mode, the 15C (flag 8 set) and the 42S ("CRES" set) will give

1+i*sqrt(3) = 1.00 + i1.732 

as the answer to (-8)^(1/3), using 1/x and y^x.

Edited: 31 Jan 2004, 3:22 p.m.


Karl: the situation you describe happened indeed with the first HP models (at least as far as the HP25) but about the time the HP27 and the HP67 were introduced, the case of the odd-integer roots of negative numbers was included as a valid, non error case. Without resorting to complex modes, many HP models (from about 1977 on) will give -2 as the cubic root of -8.

When in complex mode, the HP15C and the HP42S will give the principal value for the cubic root of -8, which is the root located in the first quadrant; that is why the answer is a complex number. In real mode, the answer will be -2 and no error condition will be claimed.


Andrès, what Karl wrote happens exactly with my HP 42S. Maybe there where different ROMS? I don't think so, but who knows..

Anyway, I just hope we don't touch negative cube roots in our exam, it would surprise me because we haven't done something with them so far.

BTW: Couldn't I just take the cube root of the positive value and then at last change the sign???


Robin, Karl:

I made a mistake, I apologize. Yhe evolution around 1977 was to accept negative entries for INTEGER POWERS, not roots (fractional powers), as I mistakenly stated.

Before evolution (HP25), (-2)^3 displays Error

After evolution (HP27,67,41), (-2)^3 displays -8

While the workaround is not very complex (no pun intended!), it will take some steps from a scarce memory pool when developing programs for these calculators; that is why this was a welcome advance. For manual operations, it was not a big issue.

Yhank you!


Andres, Robin --

Good, informative discussion. I think we're all on the same page, and have it right. I learned a couple things myself, regarding the enhancements of early units and why one of the complex-valued roots of (-8)^(1/3) is considered the "primary" root. (The other root, of course, is the complex conjugate of the primary.)

Robin is right that taking the negatvie-integer root of the absolute value of the argument, then negating the answer, is the workaround. In fact, this is what I suspect is the basis of the algorithm on improved later HP's for integer exponents of negative numbers:

For x > 0.00 (floating-point) and n an integer,

(-x)^n = exp[n*ln(x)]*[(-1)^n]   (change sign of result if n is odd)

Of course, this applies only if n is an integer.

Now, if y = 0 in y^x, x must be positive -- Negative x yields divide by 0, and x = 0 yields undefined 0^0 -- READERS: Please don't launch that thread again!.

Makes one appreciate what a complete implementation of mathematical functionality entails, doesn't it?

Edited: 1 Feb 2004, 3:49 p.m.


Now, if y = 0 in y^x, x must be positive -- Negative x yields divide by 0, and x = 0 yields undefined 0^0 -- READERS: Please don't launch that thread again!




"Now, if y = 0 in y^x, x must be positive -- Negative x yields divide by 0, and x = 0 yields

undefined 0^0 -- READERS: Please don't
launch that thread again!."

Have a look at this interesting link:


My own opinion is that assigning 0^0 the value 1 is far more useful and consistent that simply leaving it undefined. It isn't more 'true', just more useful.

Also, I've found it very intuitive and enlightening to consider the value of the function x^n for integer, positive n to actually mean the number of times you need to multiply 1 by n to compute the result. So:

        X^1 = 1 * X          (multiply 1 by X once)
X^2 = 1 * X * X (multiply 1 by X twice)
X^3 = 1 * X * X * X (multiply 1 by X thrice)

and so on. Then we have, naturally:

X^0 = 1 (multiply 1 by X zero times)

and further, when X happens to be zero:

0^0 = 1 (multiply 1 by 0 zero times)

So this natural definition fully coincides with the usual
values of x^n for integer, positive n, and has no problem
at all when either x or n or both are zero.

For negative n, just change "multiply" to "divide".

Best regards from V.


As Karl, wrote, please DO NOT START THE 0^0 THREAD AGAIN.

There are good reasons to expect it to be 1. There are good reasons to expect it to be 0. There are even reasons to expect it to be other values; in fact, for any numeric value you can easily construct an argument that 0^0 should be that value. That is why it is undefined. If you make it evaluate to any particular numeric value (0, 1 or something else), it will be wrong for at least some of the cases.

I'm not going to give any mathematical explanations because this has been discussed to death already. You can find any number of discussions of it using Google.

Possibly Related Threads...
Thread Author Replies Views Last Post
  [HP-Prime CAS] "Warning, ^ (Command) Is ambiguous on non square matrices"?? CompSystems 1 1,429 12-07-2013, 07:15 PM
Last Post: CompSystems
  [HP Prime] Using n-root symbol and exponent problem uklo 7 2,116 11-11-2013, 01:39 AM
Last Post: Alberto Candel
  A brand new calculator benchmark: "middle square method seed test" Pier Aiello 25 5,060 09-13-2013, 01:58 PM
Last Post: Pier Aiello
  Cubic root (-8) = 2 ? Gilles Carpentier 37 7,267 08-12-2013, 10:26 PM
Last Post: jep2276
  Square Root Simplifier for HP39gII Mic 4 1,543 03-11-2013, 08:25 AM
Last Post: Eddie W. Shore
  Cube root on standard calculator Thomas Klemm 22 4,736 11-09-2012, 06:11 AM
Last Post: Pierre
  ROOT bug? HP 48S/48G Eddie W. Shore 8 3,135 07-13-2012, 07:05 PM
Last Post: Eddie W. Shore
  [WP34S] Improving the Upper-Tail F and Chi-Square Les Wright 7 1,841 05-12-2012, 06:31 PM
Last Post: Paul Dale
  [WP34S] Chi-Square Functions Broken in 2935 Les Wright 7 1,766 05-03-2012, 11:10 AM
Last Post: Les Wright
  x root y on hp42s David Griffith 14 3,322 04-08-2012, 12:43 PM
Last Post: Walter B

Forum Jump: