title: Efficient and accurate computation of the Mills ratio of the standard normal distribution
body: <p>The <a href="https://en.wikipedia.org/wiki/Mills_ratio" rel="nofollow noreferrer">Mills ratio</a> M(x) was introduced by John Mills to express the relationship between a distribution's cumulative distribution function and its probability density function:</p>
  
  <p>J. P. Mills, "Table of the ratio: Area to bounding ordinate, for any portion of normal curve". <em>Biometrika</em>, Vol. 18, No. 3/4 (Nov. 1926), pp. 395-400. (<a href="http://www.jstor.org/stable/2331957" rel="nofollow noreferrer">online</a>)</p>
  
  <p>The <a href="http://mathworld.wolfram.com/MillsRatio.html" rel="nofollow noreferrer">definition</a> of the Mills ratio is (1 - D(x)) / P(x), where D denotes the distribution function and P(x) is the probability density function. In the specific case of the standard normal distribution, we then have M(x) = (1 - Φ(x)) / ϕ(x) = Φ(-x) / ϕ(x), or when expressed via the complementary error function, M(x) = e<sup>x<sup>2</sup></sup> √(π/2) erfc (x/√2) = √(π/2) erfcx (x/√2).</p>
  
  <p>Previous questions have dealt with the computation of the Mills ratio in mathematical environments like <a href="https://stackoverflow.com/questions/24056388/creating-mills-ratio-in-r-for-large-values">R</a> and <a href="https://stackoverflow.com/questions/17713981/inverse-mills-ratio-in-matlab">Matlab</a>, but the sophisticated computational facilities of these environments have no equivalent in C. How can one compute the Mills ratio for the standard normal distribution accurately and efficiently using just the C standard math library?</p>