I need to program a simple Probability calculation function for any given Z boundaries (Area P under the normal distribution curve):
I know we can use the The Z table, but I want to actually calculate it - I found that the actual calculation is:

And for speeding up we can use Taylor Expansion:

Now I implemented it in my own code but I came across a function that looks extremely simple and produce accurate results:
function calc_Area_Between(_zActual) {
var p1 = 1*0;
var p2 = 1*0;
var pmid = 1*0;
var z = Math.abs(_zActual);
p2 = (((((.000005383*z+.0000488906)*z+.0000380036)*z+.0032776263)*z+.0211410061)*z+.049867347)*z+1;
p2 = Math.pow(p2, ‐16);
p1 = p2/2;
pmid = 1‐p2;
pmid = Math.round(pmid*10000)/10000;
p2 = Math.round(p2*10000)/10000; //To sides
p1 = Math.round(p1*10000)/10000; //One sided
if(z>3.75) return 100;
return pmid;
}
Can anyone Explain What is going on there? especially the p2 calculation with those float numbers?