4.12 Polynomial approximation
Handbook of Mathematical Functions by Abramowitz and Stegun, 26.2.16 & 26.2.17, p932
Practice script
PolyNom3
## function (x)
## {
## CO1 = 0.4361836
## CO2 = -0.1201676
## CO3 = 0.937298
## CO4 = 0.33267
## TMP1 = exp(-x * x/2)/sqrt(2 * pi)
## TMP2 = 1/(1 + abs(x) * CO4)
## y = TMP1 * (CO1 * TMP2 + CO2 * TMP2^2 + CO3 * TMP2^3)
## if (x > 0)
## y = 1 - y
## return(y)
## }
## <bytecode: 0x000001e2a443f2b0>
## <environment: namespace:math>
format(PolyNom3(2), digits=22)
## [1] "0.9772411898846421474119"
format(pnorm(2), digits=22) # Compare with the above
## [1] "0.9772498680518207914147"