Feature #10226 » _ math.c Convert indentation to space.PATCH
math.c | ||
---|---|---|
dx = RFLOAT_VALUE(x);
|
||
dy = RFLOAT_VALUE(y);
|
||
if (dx == 0.0 && dy == 0.0) {
|
||
if (!signbit(dx))
|
||
return DBL2NUM(dy);
|
||
if (!signbit(dx))
|
||
return DBL2NUM(dy);
|
||
if (!signbit(dy))
|
||
return DBL2NUM(M_PI);
|
||
return DBL2NUM(-M_PI);
|
||
return DBL2NUM(M_PI);
|
||
return DBL2NUM(-M_PI);
|
||
}
|
||
#ifndef ATAN2_INF_C99
|
||
if (isinf(dx) && isinf(dy)) {
|
||
/* optimization for FLONUM */
|
||
if (dx < 0.0) {
|
||
const double dz = (3.0 * M_PI / 4.0);
|
||
return (dy < 0.0) ? DBL2NUM(-dz) : DBL2NUM(dz);
|
||
}
|
||
else {
|
||
const double dz = (M_PI / 4.0);
|
||
return (dy < 0.0) ? DBL2NUM(-dz) : DBL2NUM(dz);
|
||
}
|
||
/* optimization for FLONUM */
|
||
if (dx < 0.0) {
|
||
const double dz = (3.0 * M_PI / 4.0);
|
||
return (dy < 0.0) ? DBL2NUM(-dz) : DBL2NUM(dz);
|
||
}
|
||
else {
|
||
const double dz = (M_PI / 4.0);
|
||
return (dy < 0.0) ? DBL2NUM(-dz) : DBL2NUM(dz);
|
||
}
|
||
}
|
||
#endif
|
||
return DBL2NUM(atan2(dy, dx));
|
||
... | ... | |
rb_scan_args(argc, argv, "11", &x, &base);
|
||
d = math_log1(x);
|
||
if (argc == 2) {
|
||
d /= math_log1(base);
|
||
d /= math_log1(base);
|
||
}
|
||
return DBL2NUM(d);
|
||
}
|
||
... | ... | |
x = rb_big_rshift(x, SIZET2NUM(numbits));
|
||
}
|
||
else {
|
||
numbits = 0;
|
||
numbits = 0;
|
||
}
|
||
Need_Float(x);
|
||
... | ... | |
x = rb_big_rshift(x, SIZET2NUM(numbits));
|
||
}
|
||
else {
|
||
numbits = 0;
|
||
numbits = 0;
|
||
}
|
||
Need_Float(x);
|
||
... | ... | |
x = rb_big_rshift(x, SIZET2NUM(numbits));
|
||
}
|
||
else {
|
||
numbits = 0;
|
||
numbits = 0;
|
||
}
|
||
Need_Float(x);
|
||
... | ... | |
if (isinf(d0) && signbit(d0)) domain_error("gamma");
|
||
fracpart = modf(d0, &intpart);
|
||
if (fracpart == 0.0) {
|
||
if (intpart < 0) domain_error("gamma");
|
||
if (0 < intpart &&
|
||
intpart - 1 < (double)numberof(fact_table)) {
|
||
return DBL2NUM(fact_table[(int)intpart - 1]);
|
||
}
|
||
if (intpart < 0) domain_error("gamma");
|
||
if (0 < intpart &&
|
||
intpart - 1 < (double)numberof(fact_table)) {
|
||
return DBL2NUM(fact_table[(int)intpart - 1]);
|
||
}
|
||
}
|
||
d = tgamma(d0);
|
||
return DBL2NUM(d);
|
||
... | ... | |
d0 = RFLOAT_VALUE(x);
|
||
/* check for domain error */
|
||
if (isinf(d0)) {
|
||
if (signbit(d0)) domain_error("lgamma");
|
||
return rb_assoc_new(DBL2NUM(INFINITY), INT2FIX(1));
|
||
if (signbit(d0)) domain_error("lgamma");
|
||
return rb_assoc_new(DBL2NUM(INFINITY), INT2FIX(1));
|
||
}
|
||
d = lgamma_r(d0, &sign);
|
||
v = DBL2NUM(d);
|