示例#1
0
int main() {
	float f = 0.1;
	printf("%f", f); 
	printf("%d", __finitef(f)); 
	if (!__finitef(f)) {
		//@ assert \false;
	}

}
示例#2
0
float
__hypotf(float x, float y)
{
	float z = __ieee754_hypotf(x,y);
	if(__builtin_expect(!__finitef(z), 0)
	   && __finitef(x) && __finitef(y) && _LIB_VERSION != _IEEE_)
	    /* hypot overflow */
	    return __kernel_standard_f(x, y, 104);

	return z;
}
示例#3
0
float
__lgammaf_r(float x, int *signgamp)
{
	float y = __ieee754_lgammaf_r(x,signgamp);
	if(__builtin_expect(!__finitef(y), 0)
	   && __finitef(x) && _LIB_VERSION != _IEEE_)
		return __kernel_standard_f(x, x,
					   __floorf(x)==x&&x<=0.0f
					   ? 115 /* lgamma pole */
					   : 114); /* lgamma overflow */

	return y;
}
示例#4
0
/* wrapper powf */
float
__powf (float x, float y)
{
    float z = __ieee754_powf (x, y);
    if (__builtin_expect (!__finitef (z), 0))
    {
        if (_LIB_VERSION != _IEEE_)
        {
            if (__isnanf (x))
            {
                if (y == 0.0f)
                    /* pow(NaN,0.0) */
                    return __kernel_standard_f (x, y, 142);
            }
            else if (__finitef (x) && __finitef (y))
            {
                if (__isnanf (z))
                    /* pow neg**non-int */
                    return __kernel_standard_f (x, y, 124);
                else if (x == 0.0f && y < 0.0f)
                {
                    if (signbit (x) && signbit (z))
                        /* pow(-0.0,negative) */
                        return __kernel_standard_f (x, y, 123);
                    else
                        /* pow(+0.0,negative) */
                        return __kernel_standard_f (x, y, 143);
                }
                else
                    /* pow overflow */
                    return __kernel_standard_f (x, y, 121);
            }
        }
    }
    else if (__builtin_expect (z == 0.0f, 0) && __finitef (x) && __finitef (y)
             && _LIB_VERSION != _IEEE_)
    {
        if (x == 0.0f)
        {
            if (y == 0.0f)
                /* pow(0.0,0.0) */
                return __kernel_standard_f (x, y, 120);
        }
        else
            /* pow underflow */
            return __kernel_standard_f (x, y, 122);
    }

    return z;
}
示例#5
0
float __builtin_lgammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */
{
#ifdef _IEEE_LIBM
	return __hide_ieee754_lgammaf_r(x,signgamp);
#else
        float y;
	struct exception exc;
        y = __hide_ieee754_lgammaf_r(x,signgamp);
        if(_LIB_VERSION == _IEEE_) return y;
        if(!__finitef(y)&&__finitef(x)) {
#ifndef HUGE_VAL 
#define HUGE_VAL inf
	    double inf = 0.0;

	    SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
#endif
	    exc.name = "lgammaf";
	    exc.err = 0;
	    exc.arg1 = exc.arg2 = (double)x;
            if (_LIB_VERSION == _SVID_)
               exc.retval = HUGE;
            else
               exc.retval = HUGE_VAL;
	    if(__builtin_floorf(x)==x&&x<=(float)0.0) {
		/* lgammaf(-integer) or lgamma(0) */
		exc.type = SING;
		if (_LIB_VERSION == _POSIX_)
		   errno = EDOM;
		else if (!__builtin_matherr(&exc)) {
		   errno = EDOM;
		}

            } else {
		/* lgammaf(finite) overflow */
		exc.type = OVERFLOW;
                if (_LIB_VERSION == _POSIX_)
		   errno = ERANGE;
                else if (!__builtin_matherr(&exc)) {
                   errno = ERANGE;
		}
            }
	    if (exc.err != 0)
	       errno = exc.err;
            return (float)exc.retval; 
        } else
            return y;
#endif
}
示例#6
0
文件: w_scalbf.c 项目: dreal/tai
sysv_scalbf (float x, float fn)
{
  float z = __ieee754_scalbf (x, fn);

  if (__builtin_expect (__isinff (z), 0))
    {
      if (__finitef (x))
	return __kernel_standard_f (x, fn, 132); /* scalb overflow */
      else
	__set_errno (ERANGE);
    }
  else if (__builtin_expect (z == 0.0f, 0) && z != x)
    return __kernel_standard_f (x, fn, 133); /* scalb underflow */

  return z;
}
float
__exp2f (float x)		/* wrapper exp2f */
{
#ifdef _IEEE_LIBM
  return __ieee754_exp2f (x);
#else
  float z;
  z = __ieee754_exp2f (x);
  if (_LIB_VERSION != _IEEE_ && __finitef (x))
    {
      if (x > o_threshold)
	/* exp2 overflow */
	return (float) __kernel_standard ((double) x, (double) x, 144);
      else if (x <= u_threshold)
	/* exp2 underflow */
	return (float) __kernel_standard ((double) x, (double) x, 145);
    }
  return z;
#endif
}