diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-06 05:53:03 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-06 05:53:03 +0000 |
| commit | 8ce6c0265b6f788d5e20c24ba69dfd802c7c1b08 (patch) | |
| tree | d6cfec215d6194c81d652da0ddad654474dfc1eb | |
| parent | 8022ebaa5bb7aae18ad622d7052a11889a03758f (diff) | |
| download | ruby-8ce6c0265b6f788d5e20c24ba69dfd802c7c1b08.tar.gz ruby-8ce6c0265b6f788d5e20c24ba69dfd802c7c1b08.tar.xz ruby-8ce6c0265b6f788d5e20c24ba69dfd802c7c1b08.zip | |
* missing/lgamma_r.c (loggamma): return 0 for 1 and 2.
* test/ruby/test_math.rb: accept errors by functions under missing/.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | missing/lgamma_r.c | 2 | ||||
| -rw-r--r-- | test/ruby/test_math.rb | 3 |
3 files changed, 10 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Thu Mar 6 14:46:08 2008 Tanaka Akira <akr@fsij.org> + + * missing/lgamma_r.c (loggamma): return 0 for 1 and 2. + + * test/ruby/test_math.rb: accept errors by functions under missing/. + Thu Mar 6 14:29:44 2008 NARUSE, Yui <naruse@ruby-lang.org> * transcode.c (rb_str_transcode_bang): set coderange. diff --git a/missing/lgamma_r.c b/missing/lgamma_r.c index ab6c28294..ae93d078c 100644 --- a/missing/lgamma_r.c +++ b/missing/lgamma_r.c @@ -34,6 +34,8 @@ loggamma(double x) /* the natural logarithm of the Gamma function. */ { double v, w; + if (x == 1.0 || x == 2.0) return 0.0; + v = 1; while (x < N) { v *= x; x++; } w = 1 / (x * x); diff --git a/test/ruby/test_math.rb b/test/ruby/test_math.rb index 60fc591a6..67f5e86e4 100644 --- a/test/ruby/test_math.rb +++ b/test/ruby/test_math.rb @@ -2,7 +2,8 @@ require 'test/unit' class TestMath < Test::Unit::TestCase def check(a, b) - assert_in_delta(a, b, Float::EPSILON * 4) + err = [Float::EPSILON * 4, [a.abs, b.abs].max * Float::EPSILON * 256].max + assert_in_delta(a, b, err) end def test_atan2 |
