[前][次][番号順一覧][スレッド一覧]

ruby-changes:4218

From: ko1@a...
Date: Thu, 6 Mar 2008 14:53:25 +0900 (JST)
Subject: [ruby-changes:4218] akr - Ruby:r15708 (trunk): * missing/lgamma_r.c (loggamma): return 0 for 1 and 2.

akr	2008-03-06 14:53:03 +0900 (Thu, 06 Mar 2008)

  New Revision: 15708

  Modified files:
    trunk/ChangeLog
    trunk/missing/lgamma_r.c
    trunk/test/ruby/test_math.rb

  Log:
    * missing/lgamma_r.c (loggamma): return 0 for 1 and 2.
    
    * test/ruby/test_math.rb: accept errors by functions under missing/.
    


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/missing/lgamma_r.c?r1=15708&r2=15707&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15708&r2=15707&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_math.rb?r1=15708&r2=15707&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15707)
+++ ChangeLog	(revision 15708)
@@ -1,3 +1,9 @@
+Thu Mar  6 14:46:08 2008  Tanaka Akira  <akr@f...>
+
+	* 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@r...>
 
 	* transcode.c (rb_str_transcode_bang): set coderange.
Index: test/ruby/test_math.rb
===================================================================
--- test/ruby/test_math.rb	(revision 15707)
+++ test/ruby/test_math.rb	(revision 15708)
@@ -2,7 +2,8 @@
 
 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
Index: missing/lgamma_r.c
===================================================================
--- missing/lgamma_r.c	(revision 15707)
+++ missing/lgamma_r.c	(revision 15708)
@@ -34,6 +34,8 @@
 {
     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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]