Casio PB-2000C

Datasheet legend
Ab/c: Fractions calculation
AC: Alternating current
BaseN: Number base calculations
Card: Magnetic card storage
Cmem: Continuous memory
Cond: Conditional execution
Const: Scientific constants
Cplx: Complex number arithmetic
DC: Direct current
Eqlib: Equation library
Exp: Exponential/logarithmic functions
Fin: Financial functions
Grph: Graphing capability
Hyp: Hyperbolic functions
Ind: Indirect addressing
Intg: Numerical integration
Jump: Unconditional jump (GOTO)
Lbl: Program labels
LCD: Liquid Crystal Display
LED: Light-Emitting Diode
Li-ion: Lithium-ion rechargeable battery
Lreg: Linear regression (2-variable statistics)
mA: Milliamperes of current
Mtrx: Matrix support
NiCd: Nickel-Cadmium rechargeable battery
NiMH: Nickel-metal-hydrite rechargeable battery
Prnt: Printer
RTC: Real-time clock
Sdev: Standard deviation (1-variable statistics)
Solv: Equation solver
Subr: Subroutine call capability
Symb: Symbolic computing
Tape: Magnetic tape storage
Trig: Trigonometric functions
Units: Unit conversions
VAC: Volts AC
VDC: Volts DC
Years of production: 1989  Display type: Graphical display  
New price:   Display color: Black  
    Display technology: Liquid crystal display 
Size: 3½"×7½"×1" Display size: 196×32 pixels
Weight: 12 oz    
    Entry method: Formula entry 
Batteries: 3×"CR-2032" Lithium + 1×"CR-1220" Lithium Advanced functions: Trig Exp Cmem Snd 
External power: 9VDC   Memory functions:  
I/O: Casio I/O, Expansion port     
    Programming model: C Programmable 
Precision: 13 digits Program functions: Jump Cond Subr Lbl Ind  
Memories: 32(0) kilobytes Program display: Text display  
Program memory: 32 kilobytes Program editing: Text editor  
Chipset:   Forensic result:  

pb2000c.jpg (35053 bytes)The PB-2000C is one of the most unusual calculators made by Casio.

This curious beast is actually programmable in the C language. No kidding! You write your program in plain (pre-ANSI) C, save it from the built-in text editor, compile it, and run the result. This is true C we're talking about, ladies and gentlemen, not some emulation/simulation: you get the whole works, pointers and all, so it is in fact quite possible to lock up the machine for good with a bad pointer assignment, for instance. A small RAM-based file system implementation is used for storing program and data files. The machine also has the ability to interface with external peripherals. This is a surprisingly useful machine!

I received this machine as a gift from Paul Fox, author of the venerable CRiSP editor. Although Paul was unable to supply a manual, it was not very difficult to figure out the basic functionality of this computer. (Mind you, it'd be nice to get my hands on a reference manual for all the built-in library functions.)

In addition to C, the machine also provides limited "programmability" in the form of a single-formula storage memory where a formula can be stored, edited, and executed.

The C implementation is quite robust. It can even handle fairly obfuscated C code, such as the following single-line monstrosity computing the value of π to an arbitrary number of digits:

long a=10000,b,c,d,e,*f,g;
main(){printf("digits?");scanf("%ld",&c);c*=3.5;c-=c%14;f=malloc(4*c+4);
for(;b-c;)f[b++]=a/5;for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)
for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b);}

(This code is not of my own creation. I downloaded it ages ago from the Internet. I have no idea as to the identity of its original author.)

Of course the machine isn't particularly fast. Computing 50 digits of π takes several minutes. But, it works.

I have, of course, also written a Gamma function program for the PB-2000C. Finally, I could do this in C! This beast computes the logarithm of the Gamma function for any real argument to 10+ digits of precision:

double lg(x)
double x;
{
	double g;
	double pi = 3.14159265359;
	int s;

	s = x<0;
	x = s ? -x : x;

	g = 2.506628283501;
	g += 92.20704845211 / x++;
	g -= 83.17763708288 / x++;
	g += 14.80283193078 / x++;
	g -= .2208497079533 / x;
	g = log(g) + (x-3.5)*log(x + .85) - x - .85;
	return s ? log(pi/(3-x)/sin(180*(x-3))) - g : g;
}

main()
{
	double g, x;
	printf("%lf", &x);
	g = lg(x);
	printf("lnG(%g)=%14.12g
", x, g);
	printf("G(%g)=%14.12g", x, exp(g));
}