Enter RPN

Files in r47/EML/ of trunk
Login

Files in r47/EML/ of trunk

Files in directory r47/EML from the latest check-in of branch trunk


EML/Suite for the R47/C47

The reference implementation of EML/Suite, taking full advantage of the SwissMicros R47 and its FOSS DIY version, the C47.

Rather than key in all this code on-device, I wrote the source code in the one true programmer’s text editor,1 then used rejig to produce the program file:

$ rejig Suite.p47u -o Suite.p47

Or, thanks to the provided Makefile, just say make.

The result may then be loaded into the C47/R47 with the 🟦 I/O READP command.

The *.s47 files are C47/R47 statefiles containing this same suite. Each also implements one of the menus described in the linked article. Load them via 🟦 I/O LOADST.

Usage

Full details are in the article linked above.

Subroutines taking arguments follow the traditional RPN order used by the builtin operations.

The Eleven example is standalone, in the spirit of Two but not used in the article. Comparing these shows what happens as the numbers get bigger. Notice that it needs to use 8 temporary registers to avoid blowing the R47’s default SSIZE8 stack. It would be even worse under a traditional 4-level HP RPN stack.

Resources

Operands are consumed and replaced with results in the same manner as the builtin equivalents. Prior elements on the stack may be pushed off the top by intermediate calculations, but no “litter” is left behind.

This version requires that you run the calculator in SSIZE8 mode. Prior versions worked in SSIZE4, but that was a stepping-stone effort to get to the HP-42S version. Once we had that, we refocused this reference implementation on exemplary clarity over stack efficiency.

This version uses the C47/R47 LocR feature to isolate scratchpad usage to each subroutine. No global registers are used, and no global variables are created.

Limitations

The article goes into details, but there are a few things that are important enough to understand that they bear repeating:

  1. Where this suite mirrors builtin ops, it is never more accurate, and in many cases, it is significantly less accurate.

  2. Addition and multiplication aren’t strictly commutative due to differences in the way the arguments are handled. Swapping their order will give slightly different results!

  3. Because much of the suite operates on the complex plane, errors tend to show up as real results with tiny imaginary error terms down in the `10^-34` range.

License

These programs are © 2026 by Warren Young and offered under the terms of the MIT License.


  1. ^ In this specific case Cursor with the Neovim plugin, but vi generically, being the proper baseline for writing software. I have spoken.