lgamma_r.c: fix at -0.0
* math.c (ruby_lgamma_r): missing/lgamma_r.c is used on Windows, since msvcrt does not provide it. * missing/lgamma_r.c (lgamma_r): fix lgamma(-0.0). [ruby-core:74823] [Bug #12249] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bb7a4c2a00
commit
39330d6b79
@ -1,3 +1,11 @@
|
|||||||
|
Wed Apr 6 10:17:53 2016 cremno phobia <cremno@mail.ru>
|
||||||
|
|
||||||
|
* math.c (ruby_lgamma_r): missing/lgamma_r.c is used on Windows,
|
||||||
|
since msvcrt does not provide it.
|
||||||
|
|
||||||
|
* missing/lgamma_r.c (lgamma_r): fix lgamma(-0.0).
|
||||||
|
[ruby-core:74823] [Bug #12249]
|
||||||
|
|
||||||
Wed Apr 6 01:22:55 2016 NAKAMURA Usaku <usa@ruby-lang.org>
|
Wed Apr 6 01:22:55 2016 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* math.c (ruby_lgamma_r): mswin's lgamma_r also seems to be wrong.
|
* math.c (ruby_lgamma_r): mswin's lgamma_r also seems to be wrong.
|
||||||
|
2
math.c
2
math.c
@ -750,7 +750,7 @@ ruby_tgamma(const double d)
|
|||||||
#define tgamma(d) ruby_tgamma(d)
|
#define tgamma(d) ruby_tgamma(d)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _WIN32 || defined __APPLE__
|
#if defined __APPLE__
|
||||||
static inline double
|
static inline double
|
||||||
ruby_lgamma_r(const double d, int *sign)
|
ruby_lgamma_r(const double d, int *sign)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ lgamma_r(double x, int *signp)
|
|||||||
double i, f, s;
|
double i, f, s;
|
||||||
f = modf(-x, &i);
|
f = modf(-x, &i);
|
||||||
if (f == 0.0) { /* pole error */
|
if (f == 0.0) { /* pole error */
|
||||||
*signp = 1;
|
*signp = signbit(x) ? -1 : 1;
|
||||||
errno = ERANGE;
|
errno = ERANGE;
|
||||||
return HUGE_VAL;
|
return HUGE_VAL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user