HP Forums
Bug in 21, 25 - y raised to the x - 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: Bug in 21, 25 - y raised to the x (/thread-25234.html)

Bug in 21, 25 - y raised to the x - Don Davis - 12-18-2002

I came across an interesting bug when playing around with an HP-21 I recently acquired. If I try to square a negative number using the "y raised to the x" key, I get an error message. The same is true on the HP-25 I tried, although using the x^2 key works fine.

I am sure this is probably well-known to HP enthusiasts in this group, but I did not find documentation of it when I searched. Does anyone know more about this bug - i.e., when it was corrected? My 34C handles the calculation just fine. I think the 29C does also, although I cannot verify that at the moment.

best regards,

Re: Bug in 21, 25 - y raised to the x - Ernie Malaga - 12-18-2002


This "bug" is present in the oldest HP calculators. I suppose it's due to the fact that powers were calculated by way of logarithms, and you can't apply the LN function to a negative number. More modern calculators circumvent this problem by analyzing both numbers, and work the sign of the result based on that. If I'm not mistaken, the HP-67/97 were the first calculators to be able to raise negative numbers to whole powers.

By the same token, the oldest machines allowed you to CHS the number zero, and I think I read somewhere that the HP-35 gave an error message if you tried to calculate the square root of -0. More modern calculators don't change the sign of zero no matter how many times you press CHS.

Ain't life innerestin'?


Re: Bug in 21, 25 - y raised to the x - Raymond Del Tondo - 12-18-2002


I think the low end TI's still can't calculate powers with negative exponents...


Re: Bug in 21, 25 - y raised to the x - Michel Beaulieu - 12-18-2002

no, it's with negative base they have problems... :-)

I would not call it a bug... - Andrés C. Rodríguez (Argentina) - 12-20-2002

Certinly y^x was calculated using logarythms, and negative base was not allowed. I think it was around the HP67 time when the internal routines were improved to accept integer powers for negative bases. It was a nice improvement but not more than a sophistication handled before (with no complaints) by the users ...

It works fine on the 29C - Harry (Germany) - 12-24-2002

Just checked it.