Post Reply 
NQ41 RPN Calculator
12-02-2017, 11:09 PM (This post was last modified: 10-04-2020 05:34 PM by Craig Bladow.)
Post: #1
NQ41 RPN Calculator
I've been working on a command line RPN calculator program that I'm calling "NQ41" which stands for "Not Quite a 41". Smile

Since the release of version 0.1 the program supports continuous memory, running commands from an input file or STDIN and flags. Interactive mode is enabled by launching with ./nq41 -i
Currently the program supports 319 memories and all HP-41C functions not related to programming or alpha features.

The current release is version 0.2, which implements the ability to exit the Linux and Mac versions via "ctrl-d".

If you are familiar with HP's RPN calculators such as the HP-25 or HP-41 then learning to use this program should not be difficult.
The math functions currently use the default double precision floating point libraries provided for these operating systems.

This is a command line client for OS X 10.8 and later, Windows 7/10 and Linux x86-64bit.

Download zip file for version 0.20: https://www.dropbox.com/s/vj67jn1k466izkm/NQ41.zip?dl=1

sha256 of zip file for version 0.20: 7d861ea85d1369b53fb32ed140f5011b72d255cc0e2306ddc9a590d2d01ce4db

To confirm the sha256 checksum:
In OS X terminal: shasum -a 256 NQ41.zip
In Linux terminal: sha256sum NQ41.zip
In Windows: Install 7-zip, navigate to NQ41.zip, right click on it selecting "CRC->SHA-256" or use another utility that you trust.

After un-compressing the zip file, run 'nq41 -i' from the folder corresponding to your computer's operating system.

Depending on your computer's security settings you may have to take extra steps to approve running this program.

This is just the first step so I invite feedback on issues that people observe.

Code:

$ ./nq41 -i
Welcome to NQ41 (Not Quite a -41!)
Version 0.20
Copyright (C) 2017-2018 Craig Bladow. All rights reserved.
This experimental software is released for the sole purpose of testing and feedback and without warranty of any kind.

Input commands and numbers, separated by spaces, and press return.
A space or return after a number is the same as the command 'enter'.
Use 'exit' to quit and 'cat 3' for a list of commands.

Memory cleared

> cat 3
 *, +, /, -, chs, 1/x, rup, rdn, x<>y, lastx, %, x^2, sqrt, enter, ln, e^x, log, 10^x, deg, rad, grd, pi, sin, cos, tan, asin, acos, atan, p-r, r-p, hms, hr, abs, int, frc, sum+, sum-, 
mean, sdev, sto, rcl, fix, sci, eng, clx, clst, clrg, prstk, trace, exit, cat, y^x, fact, about, mod, %ch, changes, hms+, hms-, e^x-1, ln1+x, rnd, st+, st-, st*, st/, sumreg,
 clsum, d-r, r-d, dec, oct, sign, x<>, view, wrts, reads, wrta, reada, sf, cf, fs?, fc?, prgm, lbl,

> changes
Version 0.003 Initial Release
Version 0.004 Added commands: mod, d%, changes, hms+, hms-, e^x-1, ln1+x fixed hr and hms.
Version 0.011 Added commands: rnd, st+,st-,st*,st/,sumreg,d-r,r-d, dec, and oct. Renamed d%, catalog, clreg, clstk, frac, pr, rp to %ch, cat, clrg, clst, frc, p-r, r-p. 
Implemented stack and indirect addressing. Statistics functions now 41C compliant.
Version 0.012 and 0.013 Bug fixes.
Version 0.10 Added commands: view, wrts, wrta, reads, reada, sf, cf, fs?, fc?.
        Added interpretation of commands from standard input or from a file.
        Added loading of memory and status from a file.
Version 0.20 Added the following (incomplete - not working) commmands: pgrm, lbl. Now exits interactive mode on 'control-d'.
Usage:
For interactive mode: -i or -I 
To load memory from a file:  -l or -L filename
To run commands from a file:  -r or -R filename

x: 0.0000 y:0.0000 z:0.0000 t:0.0000 l:0.0000

> 5 45 sin sto ind y
x: 0.70711 y:5.0000 z:0.0000 t:0.0000 l:45.000

> 70 sin asin
x: 70.000 y:0.70711 z:5.0000 t:0.0000 l:0.93969

> 5 rcl ind x
x: 0.70711 y:5.0000 z:70.000 t:0.70711 l:0.93969

> 17 sto 0 42 sto 1 wrta all.mem 0 sto 0 sto 1 reada all.mem rcl 1 rcl 0
Writing all.mem
Reading all.mem
x: 17.000 y:42.000 z:42.000 t:17.000 l:0.93969

> exit
x: 17.000 y:42.000 z:42.000 t:17.000 l:0.93969

The following commands function the same, or similar enough, as in the 41C manual, with the disclaimer that the number representation and math functions are not identical: *, +, /, -, chs,
1/x, rup, rdn, x<>y, lastx, %, x^2, sqrt, enter, ln, e^x, log, 10^x, deg, rad, grd, pi, sin, cos, tan, asin, acos, atan, p-r, r-p, hr, abs, int, frc, sum+, sum-, mean, sdev, sto, rcl, fix, clx, clst,
clrg, y^x, fact, mod, %ch, e^x-1, ln1+x, rnd, st+, st-, st*, st/, sumreg, clsum, d-r, r-d, dec, oct, sign, x<>

Differences:
hms+,hms- and hms will display the results of some operations differently so while the 41c would show 1.03 the NQ-41 would show 1.0260.
prtsk, same command but print to stdout, or console.
cat, just cat 3 works and not the same.
sci,eng, While these have some affect on the display, they do not work like the 41C.

Unique to NQ-41:
about, trace, exit, changes

Up Arrow to recall previous line entries works as follows:

MS Windows 7: just works
Linux and Mac OS X: Install a program called "rlwrap" and then run nq41 as follows:
$ rlwrap ./nq41 -i

On Debian/Ubuntu/Linux Mint install rlwrap: sudo apt install rlwrap
On Mac OS X: First install Homebrew: https://brew.sh/
Then install rlwrap: $ brew install rlwrap
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
NQ41 RPN Calculator - Craig Bladow - 12-02-2017 11:09 PM
RE: NQ41 RPN Calculator - pier4r - 12-02-2017, 11:15 PM
RE: NQ41 RPN Calculator - Craig Bladow - 12-02-2017, 11:25 PM
RE: NQ41 RPN Calculator - Craig Bladow - 12-16-2017, 03:20 AM
RE: NQ41 RPN Calculator - Paul Dale - 12-16-2017, 07:14 AM
RE: NQ41 RPN Calculator - Craig Bladow - 12-16-2017, 04:05 PM
RE: NQ41 RPN Calculator - Craig Bladow - 12-16-2017, 04:37 PM
RE: NQ41 RPN Calculator - Craig Bladow - 03-01-2018, 02:41 AM
RE: NQ41 RPN Calculator - Craig Bladow - 03-01-2018, 10:48 PM
RE: NQ41 RPN Calculator - Craig Bladow - 03-02-2018, 04:48 AM
RE: NQ41 RPN Calculator - Egan Ford - 03-02-2018, 04:28 PM
RE: NQ41 RPN Calculator - Craig Bladow - 03-04-2018, 04:38 AM
RE: NQ41 RPN Calculator - Craig Bladow - 03-08-2018, 07:52 PM
RE: NQ41 RPN Calculator - Craig Bladow - 04-25-2018, 12:49 AM
RE: NQ41 RPN Calculator - Craig Bladow - 03-28-2018, 03:06 AM
RE: NQ41 RPN Calculator - pier4r - 04-13-2018, 10:29 AM
RE: NQ41 RPN Calculator - Craig Bladow - 04-13-2018, 06:23 PM
RE: NQ41 RPN Calculator - pier4r - 04-13-2018, 08:16 PM
RE: NQ41 RPN Calculator - Craig Bladow - 05-21-2018, 04:07 AM
RE: NQ41 RPN Calculator - pier4r - 05-21-2018, 08:50 AM
RE: NQ41 RPN Calculator - pier4r - 09-13-2018, 09:28 AM
RE: NQ41 RPN Calculator - pier4r - 09-13-2018, 10:15 AM
RE: NQ41 RPN Calculator - Craig Bladow - 09-13-2018, 03:00 PM
RE: NQ41 RPN Calculator - Craig Bladow - 09-14-2018, 04:12 AM
RE: NQ41 RPN Calculator - pier4r - 09-14-2018, 05:49 AM
RE: NQ41 RPN Calculator - pier4r - 10-01-2018, 04:52 PM
RE: NQ41 RPN Calculator - Craig Bladow - 10-01-2018, 06:39 PM
RE: NQ41 RPN Calculator - Craig Bladow - 10-04-2018, 02:00 AM
RE: NQ41 RPN Calculator - pier4r - 10-04-2018, 10:26 AM
RE: NQ41 RPN Calculator - Craig Bladow - 10-04-2018, 06:06 PM
RE: NQ41 RPN Calculator - cdmackay - 10-04-2018, 06:28 PM
RE: NQ41 RPN Calculator - Craig Bladow - 12-31-2018, 07:25 PM
RE: NQ41 RPN Calculator - cdmackay - 01-01-2019, 01:46 AM
RE: NQ41 RPN Calculator - Craig Bladow - 12-31-2018, 07:38 PM
RE: NQ41 RPN Calculator - Craig Bladow - 03-09-2019, 04:12 AM



User(s) browsing this thread: 1 Guest(s)