The PC-G850 can be nicely used as a calculator, albeit in BASIC, which is cumbersome.
Attached is an
RPN Complex Calculator I wrote that
emulates the HP-15C. The display shows the T,Z,Y,X stack and its "imaginary stack" S,K,J,I. All of the PC-G850 function keys work. Like the HP-15C it has complex arithmetic, 2-var statistics, STO/RCL registers, and can be extended with BASIC programs (see source code). I also threw in some extra features, such as rational approximation by continued fractions.
RUN to start, clears registers
GOTO*R to resume without clearing registers
Keys for operations and functions:
A abs, |XI| -> XI
C ceiling, ceil(XI) -> XI
E x10^ (when entering a number)
F fraction, frac(XI) -> XI
G GCD, gcd(Y,X) -> X
H hyp prefix to [arc]sin,[arc]cos,[arc]tan
I enter imag part / back to real part
J same as I (for engineers)
L linear regression, slope and intercept -> Y,X
M mean of y and x -> Y,X
N floor, floor(XI) -> XI
Q quotient and remainder of Y/X -> X,Y (quotient in X, remainder in Y)
R rational, X -> Y,X such that Y/X approximates the given X within 1E-10
S stddev Sy and Sx -> Y,X
T truncate, trunc(XI) -> XI
V variance of y and x -> Y,X
Y linear estimation of r and y given X=x -> Y,X
^ raise, YJ^XI -> XI
+ add, YJ+XI -> XI
- subtract, YJ-XI -> XI
* multiply, YJ*XI -> XI
/ divide, YJ/XI -> XI
! factorial/gamma, fact(X) gamma(X+1) -> X
% percentage, X/100*YJ -> XI
2ndF SHIFT
SHIFT does not operate
CLS clear entry
CA clear all, restart
SPACE (or SHIFT minus) change sign, -XI -> XI
ENTER push on stack
BS delete
LEFT delete
RIGHT swap XI with YJ
UP roll stack up
DOWN roll stack down
RCM last-x, push LM -> XI
S-CONST (SHIFT CONST) display registers (press key to continue)
CONST STO [+|-|*|/] #register (press digit, or op then digit)
ANS RCL [+|-|*|/] #register (press digit, or op then digit)
F<->E re<->im, swap X with I,
->DEG hh.mmss X -> degree X
->DMS degree X ->hh.mmss X
PI push pi -> X
RND random, push random 0<x<1 -> X
MDF round towards zero, round(XI) -> XI
STAT clear stat registers R2 to R7
M+ stat add Y,X (updates registers R2 to R7 as per HP-15C stat)
M- stat remove Y,X
= enter Basic expression
... any PC-G850 calculator function key such as SIN
The implementation attempts to avoid intermediate overflow and roundoff issues, e.g. Numerical Recipes and "What Every Computer Scientist Should Know About Floating-Point Arithmetic".
New and improved version: [attachment=8966] annotated with comments and [attachment=8967] without comments
To extend the program, for example to press Q to produce the quotient and remainder of Y/X, just add an entry for key Q (ASCII 81) line 181:
' Q quotient and remainder of Y/X -> X,Y (quotient in X, remainder in Y)
181 IF A=81 GOTO 1000
1000 IF I<>0 OR J<>0 OR X=0 OR X<>INT X OR Y<>INT Y OR ABS X>=1E10 OR ABS Y>=1E10 GOTO 15 ' error
1010 N=X,X=SGN X*INT(Y/ABS X),Y=Y-N*X: GOTO 40
Enjoy!