mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@15708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d2797c33bd
commit
d1cd806372
3 changed files with 10 additions and 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>
|
Thu Mar 6 14:29:44 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* transcode.c (rb_str_transcode_bang): set coderange.
|
* transcode.c (rb_str_transcode_bang): set coderange.
|
||||||
|
|
|
@ -34,6 +34,8 @@ loggamma(double x) /* the natural logarithm of the Gamma function. */
|
||||||
{
|
{
|
||||||
double v, w;
|
double v, w;
|
||||||
|
|
||||||
|
if (x == 1.0 || x == 2.0) return 0.0;
|
||||||
|
|
||||||
v = 1;
|
v = 1;
|
||||||
while (x < N) { v *= x; x++; }
|
while (x < N) { v *= x; x++; }
|
||||||
w = 1 / (x * x);
|
w = 1 / (x * x);
|
||||||
|
|
|
@ -2,7 +2,8 @@ require 'test/unit'
|
||||||
|
|
||||||
class TestMath < Test::Unit::TestCase
|
class TestMath < Test::Unit::TestCase
|
||||||
def check(a, b)
|
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
|
end
|
||||||
|
|
||||||
def test_atan2
|
def test_atan2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue