## Feature #10225 ยป _ math.c New method Math.normcdf.PATCH

View differences:

math.c
777 777
`/*`
778 778
` * call-seq:`
779
` *    Math.normcdf(x)  -> Float`
780
` *`
781
` *  Calculates cumulative distribution function (CDF) of the standard normal distribution for +x+.`
782
` *`
783
` *  Domain: (-INFINITY, INFINITY)`
784
` *`
785
` *  Codomain: (0.0, 1.0)`
786
` *`
787
` *    Math.normcdf(0) #=> 0.5`
788
` *`
789
` */`
790

791
`static VALUE`
792
`math_normcdf(VALUE obj, VALUE x)`
793
`{`
794
`    double d0, d;`
795
`    Need_Float(x);`
796
`    d0 = RFLOAT_VALUE(x);`
797
`    d = 0.5 * (1.0 + erf(d0 / sqrt(2)));`
798
`    return DBL2NUM(d);`
799
`}`
800

801
`/*`
802
` * call-seq:`
779 803
` *    Math.gamma(x)  -> Float`
780 804
` *`
781 805
` *  Calculates the gamma function of x.`
......
1010 1034
`    rb_define_module_function(rb_mMath, "erf",  math_erf,  1);`
1011 1035
`    rb_define_module_function(rb_mMath, "erfc", math_erfc, 1);`
1036
`    rb_define_module_function(rb_mMath, "normcdf",  math_normcdf,  1);`
1037

1012 1038
`    rb_define_module_function(rb_mMath, "gamma", math_gamma, 1);`
1013 1039
`    rb_define_module_function(rb_mMath, "lgamma", math_lgamma, 1);`
1014 1040
`}`