HP Forums

Full Version: Bug in 21, 25 - y raised to the x
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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,


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'?



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


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

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 ...

Just checked it.