Enter RPN

Files in jrpn-15c/hypotenuse/ of tip
Login

Files in jrpn-15c/hypotenuse/ of tip

Files in directory jrpn-15c/hypotenuse from the latest check-in


Description

Calculate either the length of a right triangle’s hypotenuse given the lengths of the legs, or one leg given the other and the hypotenuse.

Usage

Hypotenuse: leg ENTER leg XEQ A

Other Leg: hyp ENTER leg XEQ B

Resources

X and Y are consumed, with the answer in X.

Compatibility

Written using the JRPN 15c simulator, and directly importable as such.

The code can be entered as-is into a hardware HP-11C, 15C, 32S, 32SII, 33s, or 35s. For an improved version taking better advantage of the 30-series machines, see this.

The HP-16C lacks the function, but that is easily emulated with ENTER×.

The HP-12C has the same lack, and you can use the same workaround, but there are better alternatives.

See Also

Motivation here, plus other variants, including a version of the “leg” program with the HP-12C modification suggested above, plus adaptation to its weaker calling syntax.