Here is a short HP15C (DM15CC) program for normal distribution
(See below for source)
********** Phi(X) **********
LBL A
STO 2
STO 3
X^2
STO 4
1
STO 5
0
STO 6
LBL 1
2
STO+ 5
RCL 4
RCL/ 5
STO* 3
RCL 2
STO 6
RCL+ 3
STO 2
RCL- 6
ABS
1E-6
-
TEST 3
GTO 1
RCL 4
2
/
CHS
9.189385332E-1
-
E^X
RCL* 2
2
1/X
+
RTN
********** Phi-1(X) **********
LBL B
STO 1
SOLVE 2
RTN
LBL 2
GSB A
RCL- 1
RTN
Phi(X) based on this powerful algorithm:
Marsaglia in 2004:
http://www.jstatsoft.org/v11/a05/paper
http://stat-athens.aueb.gr/~jpan/papers/Panaretos-JIRSS2008%2857-72%29ft.pdf
public static double normalCDF(double x) {
double s = x, t = 0., b = x, q = x*x, i = 1.;
while(s != t) {
i += 2.;
b = b * (q/i);
t = s;
s = t + b;
}
return .5 + s * Math.exp(-.5 * q - .91893853320467274178);
}
.91893853320467274178 is in fact LN(2*PI)/2
Register usage in Phi(X) routine:
R2: s
R3: b
R4: q
R5: i
R6: t
Instead of testing s=t for ending Phi(x), I preferred testing abs(s-t)<10^-6, in order to tune the accuracy and response time:
Phi(1): 0.8413447388 (1 sec) (OK 7 significants digits)
Phi(5): 0.9999997153 (3.5 sec)(OK 8 significant digits)
Phi-1(.995): 2.575829318 (25 sec) (OK 8 significant digits)
Phi-1(.99995): 3.890588721 (49 sec) (OK 5 significant digits)