TEST(math, lgammal_r_17471883) {
  int sign;

  sign = 0;
  ASSERT_DOUBLE_EQ(HUGE_VAL, lgammal_r(0.0L, &sign));
  ASSERT_EQ(1, sign);
  sign = 0;
  ASSERT_DOUBLE_EQ(HUGE_VAL, lgammal_r(-0.0L, &sign));
  ASSERT_EQ(-1, sign);
}
Beispiel #2
0
int main(void)
{
	#pragma STDC FENV_ACCESS ON
	int yi;
	long double y;
	float d;
	int e, i, err = 0;
	struct l_li *p;

	for (i = 0; i < sizeof t/sizeof *t; i++) {
		p = t + i;

		if (p->r < 0)
			continue;
		fesetround(p->r);
		feclearexcept(FE_ALL_EXCEPT);
		y = lgammal_r(p->x, &yi);
		e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);

		if (!checkexcept(e, p->e, p->r)) {
			printf("%s:%d: bad fp exception: %s lgammal_r(%La)=%La,%lld, want %s",
				p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));
			printf(" got %s\n", estr(e));
			err++;
		}
		d = ulperrl(y, p->y, p->dy);
		// TODO: 2 ulp errors allowed
		if ((p->r==RN && fabs(d)>2) || (!isnan(p->x) && p->x!=-inf && !(p->e&DIVBYZERO) && yi != p->i)) {
			printf("%s:%d: %s lgammal_r(%La) want %La,%lld got %La,%d ulperr %.3f = %a + %a\n",
				p->file, p->line, rstr(p->r), p->x, p->y, p->i, y, yi, d, d-p->dy, p->dy);
			err++;
		}
	}
	return !!err;
}
Beispiel #3
0
OLM_DLLEXPORT long double
lgammal(long double x)
{
#ifdef OPENLIBM_ONLY_THREAD_SAFE
	int signgam;
#endif

	return (lgammal_r(x, &signgam));
}
Beispiel #4
0
static TACommandVerdict lgammal_r_cmd(TAThread thread,TAInputStream stream)
{
    long double x, res;
    int signp;

    x = readLongDouble(&stream);

    START_TARGET_OPERATION(thread);

    errno = 0;
    res = lgammal_r(x, &signp);

    END_TARGET_OPERATION(thread);

    writeInt(thread, errno);
    writeLongDouble(thread, res);
    writeInt(thread, signp);
    sendResponse(thread);

    return taDefaultVerdict;
}
Beispiel #5
0
extern long double _swift_Darwin_lgammal_r(long double x, int *psigngam) {
  return lgammal_r(x, psigngam);
}
Beispiel #6
0
long double
lgammal(long double x)
{
	return lgammal_r(x,&signgam);
}