Project

General

Profile

Feature #10225 ยป _ test_math.rb Add tests for Math.normcdf.PATCH

gogotanaka (Kazuki Tanaka), 09/11/2014 06:23 AM

View differences:

test/ruby/test_math.rb
218 218
    check(0, Math.erfc(1.0 / 0.0))
219 219
  end
220 220

  
221
  def test_normcdf
222
    check(0.5, Math.normcdf(0))
223
    check(0.9772498680518208, Math.normcdf(2))
224
    check(1.0, Math.normcdf(-2) + Math.normcdf(2))
225
    check(1.0, Math.normcdf(Float::INFINITY))
226
    check(0.0, Math.normcdf(-Float::INFINITY))
227
  end
228

  
221 229
  def test_gamma
222 230
    sqrt_pi = Math.sqrt(Math::PI)
223 231
    check(4 * sqrt_pi / 3, Math.gamma(-1.5))