Esempio n. 1
0
float complex
csinhf (float complex a)
{
  float r, i;
  float complex v;

  r = REALPART (a);
  i = IMAGPART (a);
  COMPLEX_ASSIGN (v, sinhf (r) * cosf (i), coshf (r) * sinf (i));
  return v;
}
Esempio n. 2
0
static t_int *cosh_perform(t_int *w)
{
    int nblock = (int)(w[1]);
    t_float *in = (t_float *)(w[2]);
    t_float *out = (t_float *)(w[3]);
    while (nblock--)
    {
	float f = *in++;
	*out++ = coshf(f);  /* CHECKME no protection against overflow */
    }
    return (w + 4);
}
/* cosh(z) = cosh(a)cos(b) - isinh(a)sin(b)  */
GFC_COMPLEX_4
ccoshf (GFC_COMPLEX_4 a)
{
  GFC_REAL_4 r;
  GFC_REAL_4 i;
  GFC_COMPLEX_4 v;

  r = REALPART (a);
  i = IMAGPART (a);
  COMPLEX_ASSIGN (v, coshf (r) * cosf (i), - (sinhf (r) * sinf (i)));
  return v;
}
Esempio n. 4
0
// substitute STDampedSpringStep's r with ri (i=imaginary unit),
// you get over-damping equation.
float STOverDampedSpringStep(float value){
    const float r=3.3f; // [???]
    if(value<0.f)value=0.f;
    if(value>1.f)value=1.f;

    float theta=r*value;
    float v=1.f;
    float tt=(value*(value-2.f)+1.f);
    v-=tt*coshf(theta);
    v-=(2.f/r)*(value*(value-2.f)+1.f)*sinhf(theta);
    return v;
}
Esempio n. 5
0
float complex
ctanhf(float complex z)
{
	float complex w;
	float x, y, d;

	x = crealf(z);
	y = cimagf(z);
	d = coshf (2.0f * x) + cosf (2.0f * y);
	w = sinhf (2.0f * x) / d  +  (sinf (2.0f * y) / d) * I;
	return (w);
}
Esempio n. 6
0
kiss_fft_cpx sf_ccosf(kiss_fft_cpx z)
/*< complex cosine >*/
{
    float x, y;

    x = z.r;
    y = z.i;

    z.r = coshf(y)*cosf(x);
    z.i = -sinhf(y)*sinf(x);

    return z;
}
Esempio n. 7
0
kiss_fft_cpx sf_csinhf(kiss_fft_cpx z)
/*< complex hyperbolic sine >*/
{
    float x, y;

    x = z.r;
    y = z.i;

    z.r = sinhf(x)*cosf(y);
    z.i = coshf(x)*sinf(y);

    return z;
}
Esempio n. 8
0
kiss_fft_cpx sf_ctanhf(kiss_fft_cpx z)
/*< complex hyperbolic tangent >*/
{
    float x, y, d;

    x = z.r;
    y = z.i;

    d = coshf(2*x) + cosf(2*y);
    z.r = sinhf(2*x)/ d;
    z.i = sinf (2*y)/ d;

    return z;
}
Esempio n. 9
0
ATF_TC_BODY(coshf_inrange, tc)
{
	float eps;
	float x;
	float y;
	size_t i;

	for (i = 0; i < __arraycount(values); i++) {
		x = values[i].x;
		y = values[i].y;
		eps = 1e-6 * values[i].e;

		if (fabsf(coshf(x) - y) > eps)
			atf_tc_fail_nonfatal("coshf(%g) != %g\n", x, y);
	}
}
Esempio n. 10
0
static void
cchshf(float xx, float *c, float *s)
{
	float x, e, ei;

	x = xx;
	if(fabsf(x) <= 0.5f) {
		*c = coshf(x);
		*s = sinhf(x);
	}
	else {
		e = expf(x);
		ei = 0.5f/e;
		e = 0.5f * e;
		*s = e - ei;
		*c = e + ei;
	}
}
Esempio n. 11
0
float complex
ctanf(float complex z)
{
	float complex w;
	float d;

	d = cosf( 2.0f * crealf(z) ) + coshf( 2.0f * cimagf(z) );

	if(fabsf(d) < 0.25f)
		d = _ctansf(z);

	if (d == 0.0f) {
		/*mtherr( "ctanf", OVERFLOW );*/
		w = MAXNUMF + MAXNUMF * I;
		return (w);
	}
	w = sinf (2.0f * crealf(z)) / d + (sinhf (2.0f * cimagf(z)) / d) * I;
	return (w);
}
inline
void TransverseMercatorProjector::mapBackward(float u, float v, float &x, float &y)
{
	u /= scale;
    v /= scale;

	float v_ = asinf( sinf(v) / coshf(u) );
	float u_ = atan2f( sinhf(u), cos(v) );

    float cosv = cosf(v_);
    float x_ = cosv * sinf(u_);
    float y_ = sinf(v_);
    float z_ = cosv * cosf(u_);

    float z;
    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;

    if (z > 0) { x /= z; y /= z; }
    else x = y = -1;
}
float ann_df_tanh(float _mu, float _x)
{
    float sechf = 1.0f/coshf(_mu*_x);
    return _mu*sechf*sechf;
}
Esempio n. 14
0
float Cosh(float x)
{
	return coshf(x);
}
Esempio n. 15
0
void
domathf (void)
{
#ifndef NO_FLOAT
  float f1;
  float f2;

  int i1;

  f1 = acosf(0.0);
  fprintf( stdout, "acosf          : %f\n", f1);

  f1 = acoshf(0.0);
  fprintf( stdout, "acoshf         : %f\n", f1);

  f1 = asinf(1.0);
  fprintf( stdout, "asinf          : %f\n", f1);

  f1 = asinhf(1.0);
  fprintf( stdout, "asinhf         : %f\n", f1);

  f1 = atanf(M_PI_4);
  fprintf( stdout, "atanf          : %f\n", f1);

  f1 = atan2f(2.3, 2.3);
  fprintf( stdout, "atan2f         : %f\n", f1);

  f1 = atanhf(1.0);
  fprintf( stdout, "atanhf         : %f\n", f1);

  f1 = cbrtf(27.0);
  fprintf( stdout, "cbrtf          : %f\n", f1);

  f1 = ceilf(3.5);
  fprintf( stdout, "ceilf          : %f\n", f1);

  f1 = copysignf(3.5, -2.5);
  fprintf( stdout, "copysignf      : %f\n", f1);

  f1 = cosf(M_PI_2);
  fprintf( stdout, "cosf           : %f\n", f1);

  f1 = coshf(M_PI_2);
  fprintf( stdout, "coshf          : %f\n", f1);

  f1 = erff(42.0);
  fprintf( stdout, "erff           : %f\n", f1);

  f1 = erfcf(42.0);
  fprintf( stdout, "erfcf          : %f\n", f1);

  f1 = expf(0.42);
  fprintf( stdout, "expf           : %f\n", f1);

  f1 = exp2f(0.42);
  fprintf( stdout, "exp2f          : %f\n", f1);

  f1 = expm1f(0.00042);
  fprintf( stdout, "expm1f         : %f\n", f1);

  f1 = fabsf(-1.123);
  fprintf( stdout, "fabsf          : %f\n", f1);

  f1 = fdimf(1.123, 2.123);
  fprintf( stdout, "fdimf          : %f\n", f1);

  f1 = floorf(0.5);
  fprintf( stdout, "floorf         : %f\n", f1);
  f1 = floorf(-0.5);
  fprintf( stdout, "floorf         : %f\n", f1);

  f1 = fmaf(2.1, 2.2, 3.01);
  fprintf( stdout, "fmaf           : %f\n", f1);

  f1 = fmaxf(-0.42, 0.42);
  fprintf( stdout, "fmaxf          : %f\n", f1);

  f1 = fminf(-0.42, 0.42);
  fprintf( stdout, "fminf          : %f\n", f1);

  f1 = fmodf(42.0, 3.0);
  fprintf( stdout, "fmodf          : %f\n", f1);

  /* no type-specific variant */
  i1 = fpclassify(1.0);
  fprintf( stdout, "fpclassify     : %d\n", i1);

  f1 = frexpf(42.0, &i1);
  fprintf( stdout, "frexpf         : %f\n", f1);

  f1 = hypotf(42.0, 42.0);
  fprintf( stdout, "hypotf         : %f\n", f1);

  i1 = ilogbf(42.0);
  fprintf( stdout, "ilogbf         : %d\n", i1);

  /* no type-specific variant */
  i1 = isfinite(3.0);
  fprintf( stdout, "isfinite       : %d\n", i1);

  /* no type-specific variant */
  i1 = isgreater(3.0, 3.1);
  fprintf( stdout, "isgreater      : %d\n", i1);

  /* no type-specific variant */
  i1 = isgreaterequal(3.0, 3.1);
  fprintf( stdout, "isgreaterequal : %d\n", i1);

  /* no type-specific variant */
  i1 = isinf(3.0);
  fprintf( stdout, "isinf          : %d\n", i1);

  /* no type-specific variant */
  i1 = isless(3.0, 3.1);
  fprintf( stdout, "isless         : %d\n", i1);

  /* no type-specific variant */
  i1 = islessequal(3.0, 3.1);
  fprintf( stdout, "islessequal    : %d\n", i1);

  /* no type-specific variant */
  i1 = islessgreater(3.0, 3.1);
  fprintf( stdout, "islessgreater  : %d\n", i1);

  /* no type-specific variant */
  i1 = isnan(0.0);
  fprintf( stdout, "isnan          : %d\n", i1);

  /* no type-specific variant */
  i1 = isnormal(3.0);
  fprintf( stdout, "isnormal       : %d\n", i1);

  /* no type-specific variant */
  f1 = isunordered(1.0, 2.0);
  fprintf( stdout, "isunordered    : %d\n", i1);

  f1 = j0f(1.2);
  fprintf( stdout, "j0f            : %f\n", f1);

  f1 = j1f(1.2);
  fprintf( stdout, "j1f            : %f\n", f1);

  f1 = jnf(2,1.2);
  fprintf( stdout, "jnf            : %f\n", f1);

  f1 = ldexpf(1.2,3);
  fprintf( stdout, "ldexpf         : %f\n", f1);

  f1 = lgammaf(42.0);
  fprintf( stdout, "lgammaf        : %f\n", f1);

  f1 = llrintf(-0.5);
  fprintf( stdout, "llrintf        : %f\n", f1);
  f1 = llrintf(0.5);
  fprintf( stdout, "llrintf        : %f\n", f1);

  f1 = llroundf(-0.5);
  fprintf( stdout, "lroundf        : %f\n", f1);
  f1 = llroundf(0.5);
  fprintf( stdout, "lroundf        : %f\n", f1);

  f1 = logf(42.0);
  fprintf( stdout, "logf           : %f\n", f1);

  f1 = log10f(42.0);
  fprintf( stdout, "log10f         : %f\n", f1);

  f1 = log1pf(42.0);
  fprintf( stdout, "log1pf         : %f\n", f1);

  f1 = log2f(42.0);
  fprintf( stdout, "log2f          : %f\n", f1);

  f1 = logbf(42.0);
  fprintf( stdout, "logbf          : %f\n", f1);

  f1 = lrintf(-0.5);
  fprintf( stdout, "lrintf         : %f\n", f1);
  f1 = lrintf(0.5);
  fprintf( stdout, "lrintf         : %f\n", f1);

  f1 = lroundf(-0.5);
  fprintf( stdout, "lroundf        : %f\n", f1);
  f1 = lroundf(0.5);
  fprintf( stdout, "lroundf        : %f\n", f1);

  f1 = modff(42.0,&f2);
  fprintf( stdout, "lmodff         : %f\n", f1);

  f1 = nanf("");
  fprintf( stdout, "nanf           : %f\n", f1);

  f1 = nearbyintf(1.5);
  fprintf( stdout, "nearbyintf     : %f\n", f1);

  f1 = nextafterf(1.5,2.0);
  fprintf( stdout, "nextafterf     : %f\n", f1);

  f1 = powf(3.01, 2.0);
  fprintf( stdout, "powf           : %f\n", f1);

  f1 = remainderf(3.01,2.0);
  fprintf( stdout, "remainderf     : %f\n", f1);

  f1 = remquof(29.0,3.0,&i1);
  fprintf( stdout, "remquof        : %f\n", f1);

  f1 = rintf(0.5);
  fprintf( stdout, "rintf          : %f\n", f1);
  f1 = rintf(-0.5);
  fprintf( stdout, "rintf          : %f\n", f1);

  f1 = roundf(0.5);
  fprintf( stdout, "roundf         : %f\n", f1);
  f1 = roundf(-0.5);
  fprintf( stdout, "roundf         : %f\n", f1);

  f1 = scalblnf(1.2,3);
  fprintf( stdout, "scalblnf       : %f\n", f1);

  f1 = scalbnf(1.2,3);
  fprintf( stdout, "scalbnf        : %f\n", f1);

  /* no type-specific variant */
  i1 = signbit(1.0);
  fprintf( stdout, "signbit        : %i\n", i1);

  f1 = sinf(M_PI_4);
  fprintf( stdout, "sinf           : %f\n", f1);

  f1 = sinhf(M_PI_4);
  fprintf( stdout, "sinhf          : %f\n", f1);

  f1 = sqrtf(9.0);
  fprintf( stdout, "sqrtf          : %f\n", f1);

  f1 = tanf(M_PI_4);
  fprintf( stdout, "tanf           : %f\n", f1);

  f1 = tanhf(M_PI_4);
  fprintf( stdout, "tanhf          : %f\n", f1);

  f1 = tgammaf(2.1);
  fprintf( stdout, "tgammaf        : %f\n", f1);

  f1 = truncf(3.5);
  fprintf( stdout, "truncf         : %f\n", f1);

  f1 = y0f(1.2);
  fprintf( stdout, "y0f            : %f\n", f1);

  f1 = y1f(1.2);
  fprintf( stdout, "y1f            : %f\n", f1);

  f1 = ynf(3,1.2);
  fprintf( stdout, "ynf            : %f\n", f1);
#endif
}
Esempio n. 16
0
ir_constant* ir_expression::constant_expression_value()
{
	if (this->type->is_error())
	{
		return NULL;
	}

	ir_constant* op[Elements(this->operands)] = { NULL, };
	ir_constant_data data;

	memset(&data, 0, sizeof(data));

	for (unsigned operand = 0; operand < this->get_num_operands(); operand++)
	{
		op[operand] = this->operands[operand]->constant_expression_value();
		if (!op[operand])
		{
			return NULL;
		}
	}

	check(op[0]);
	if (op[1] != NULL)
	{
		check(op[0]->type->base_type == op[1]->type->base_type ||
			this->operation == ir_binop_lshift ||
			this->operation == ir_binop_rshift);
	}

	bool op0_scalar = op[0]->type->is_scalar();
	bool op1_scalar = op[1] != NULL && op[1]->type->is_scalar();

	bool op2_scalar = op[2] ? op[2]->type->is_scalar() : false;
	unsigned c2_inc = op2_scalar ? 0 : 1;

	/* When iterating over a vector or matrix's components, we want to increase
	* the loop counter.  However, for scalars, we want to stay at 0.
	*/
	unsigned c0_inc = op0_scalar ? 0 : 1;
	unsigned c1_inc = op1_scalar ? 0 : 1;
	unsigned components;
	if (op1_scalar || !op[1])
	{
		components = op[0]->type->components();
	}
	else
	{
		components = op[1]->type->components();
	}

	void *ctx = ralloc_parent(this);

	/* Handle array operations here, rather than below. */
	if (op[0]->type->is_array())
	{
		check(op[1] != NULL && op[1]->type->is_array());
		switch (this->operation)
		{
		case ir_binop_all_equal:
			return new(ctx)ir_constant(op[0]->has_value(op[1]));
		case ir_binop_any_nequal:
			return new(ctx)ir_constant(!op[0]->has_value(op[1]));
		default:
			break;
		}
		return NULL;
	}

	switch (this->operation)
	{
	case ir_unop_bit_not:
		switch (op[0]->type->base_type)
		{
		case GLSL_TYPE_INT:
			for (unsigned c = 0; c < components; c++)
			{
				data.i[c] = ~op[0]->value.i[c];
			}
			break;
		case GLSL_TYPE_UINT:
			for (unsigned c = 0; c < components; c++)
			{
				data.u[c] = ~op[0]->value.u[c];
			}
			break;
		default:
			check(0);
		}
		break;

	case ir_unop_logic_not:
		check(op[0]->type->base_type == GLSL_TYPE_BOOL);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.b[c] = !op[0]->value.b[c];
		}
		break;

	case ir_unop_h2i:
		check(op[0]->type->base_type == GLSL_TYPE_HALF);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.i[c] = (int)op[0]->value.f[c];
		}
		break;
	case ir_unop_f2i:
		check(op[0]->type->base_type == GLSL_TYPE_FLOAT);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.i[c] = (int)op[0]->value.f[c];
		}
		break;
	case ir_unop_i2f:
	case ir_unop_i2h:
		check(op[0]->type->base_type == GLSL_TYPE_INT);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = (float)op[0]->value.i[c];
		}
		break;
	case ir_unop_u2h:
	case ir_unop_u2f:
		check(op[0]->type->base_type == GLSL_TYPE_UINT);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = (float)op[0]->value.u[c];
		}
		break;
	case ir_unop_f2h:
		check(op[0]->type->base_type == GLSL_TYPE_FLOAT);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = op[0]->value.f[c];
		}
		break;
	case ir_unop_f2u:
		check(op[0]->type->base_type == GLSL_TYPE_FLOAT);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.u[c] = (unsigned)op[0]->value.f[c];
		}
		break;
	case ir_unop_b2h:
	case ir_unop_b2f:
		check(op[0]->type->base_type == GLSL_TYPE_BOOL);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = op[0]->value.b[c] ? 1.0F : 0.0F;
		}
		break;
	case ir_unop_h2b:
		check(op[0]->type->base_type == GLSL_TYPE_HALF);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.b[c] = op[0]->value.f[c] != 0.0F ? true : false;
		}
		break;
	case ir_unop_f2b:
		check(op[0]->type->base_type == GLSL_TYPE_FLOAT);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.b[c] = op[0]->value.f[c] != 0.0F ? true : false;
		}
		break;
	case ir_unop_b2i:
		check(op[0]->type->base_type == GLSL_TYPE_BOOL);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.u[c] = op[0]->value.b[c] ? 1 : 0;
		}
		break;
	case ir_unop_i2b:
		check(op[0]->type->is_integer());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.b[c] = op[0]->value.u[c] ? true : false;
		}
		break;
	case ir_unop_u2i:
		check(op[0]->type->base_type == GLSL_TYPE_UINT);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.i[c] = op[0]->value.u[c];
		}
		break;
	case ir_unop_i2u:
		check(op[0]->type->base_type == GLSL_TYPE_INT);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.u[c] = op[0]->value.i[c];
		}
		break;
	case ir_unop_b2u:
		check(op[0]->type->base_type == GLSL_TYPE_BOOL);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.u[c] = (unsigned)op[0]->value.b[c];
		}
		break;
	case ir_unop_u2b:
		check(op[0]->type->base_type == GLSL_TYPE_UINT);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.b[c] = (bool)op[0]->value.u[c];
		}
		break;
	case ir_unop_any:
		check(op[0]->type->is_boolean());
		data.b[0] = false;
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			if (op[0]->value.b[c])
			{
				data.b[0] = true;
			}
		}
		break;

	case ir_unop_all:
		check(op[0]->type->is_boolean());
		data.b[0] = true;
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			if (op[0]->value.b[c] == false)
			{
				data.b[0] = false;
			}
		}
		break;

	case ir_unop_trunc:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = truncf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_round:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = (float)(IROUND(op[0]->value.f[c]));
		}
		break;

	case ir_unop_ceil:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = ceilf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_floor:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = floorf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_fract:
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			switch (this->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.u[c] = 0;
				break;
			case GLSL_TYPE_INT:
				data.i[c] = 0;
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.f[c] = op[0]->value.f[c] - floor(op[0]->value.f[c]);
				break;
			default:
				check(0);
			}
		}
		break;

	case ir_unop_sin:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = sinf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_cos:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = cosf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_tan:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = tanf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_asin:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = asinf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_acos:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = acosf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_atan:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = atanf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_sinh:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = sinhf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_cosh:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = coshf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_tanh:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = tanhf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_neg:
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			switch (this->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.u[c] = -((int)op[0]->value.u[c]);
				break;
			case GLSL_TYPE_INT:
				data.i[c] = -op[0]->value.i[c];
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.f[c] = -op[0]->value.f[c];
				break;
			default:
				check(0);
			}
		}
		break;

	case ir_unop_abs:
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			switch (this->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.u[c] = op[0]->value.u[c];
				break;
			case GLSL_TYPE_INT:
				data.i[c] = op[0]->value.i[c];
				if (data.i[c] < 0)
				{
					data.i[c] = -data.i[c];
				}
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.f[c] = fabs(op[0]->value.f[c]);
				break;
			default:
				check(0);
			}
		}
		break;

	case ir_unop_sign:
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			switch (this->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.u[c] = op[0]->value.i[c] > 0;
				break;
			case GLSL_TYPE_INT:
				data.i[c] = (op[0]->value.i[c] > 0) - (op[0]->value.i[c] < 0);
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.f[c] = float((op[0]->value.f[c] > 0) - (op[0]->value.f[c] < 0));
				break;
			default:
				check(0);
			}
		}
		break;

	case ir_unop_rcp:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			switch (this->type->base_type)
			{
			case GLSL_TYPE_UINT:
				if (op[0]->value.u[c] != 0.0)
				{
					data.u[c] = 1 / op[0]->value.u[c];
				}
				break;
			case GLSL_TYPE_INT:
				if (op[0]->value.i[c] != 0.0)
				{
					data.i[c] = 1 / op[0]->value.i[c];
				}
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				if (op[0]->value.f[c] != 0.0)
				{
					data.f[c] = 1.0F / op[0]->value.f[c];
				}
				break;
			default:
				check(0);
			}
		}
		break;

	case ir_unop_rsq:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = 1.0F / sqrtf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_sqrt:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = sqrtf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_exp:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = expf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_exp2:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = exp2f(op[0]->value.f[c]);
		}
		break;

	case ir_unop_log:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = logf(op[0]->value.f[c]);
		}
		break;

	case ir_unop_log2:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = log2f(op[0]->value.f[c]);
		}
		break;

	case ir_unop_normalize:
		check(op[0]->type->is_float());
		{
			float mag = 0.0f;
			for (unsigned c = 0; c < op[0]->type->components(); c++)
			{
				mag += op[0]->value.f[c] * op[0]->value.f[c];
			}
			mag = sqrtf(mag);
			for (unsigned c = 0; c < op[0]->type->components(); c++)
			{
				data.f[c] = op[0]->value.f[c] / mag;
			}
		}
		break;

	case ir_unop_dFdx:
	case ir_unop_dFdy:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = 0.0;
		}
		break;

	case ir_binop_pow:
		check(op[0]->type->is_float());
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = powf(op[0]->value.f[c], op[1]->value.f[c]);
		}
		break;

	case ir_binop_atan2:
		check(op[0]->type->is_float());
		check(op[1] && op[1]->type->base_type == op[0]->type->base_type);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			data.f[c] = atan2f(op[0]->value.f[c], op[1]->value.f[c]);
		}
		break;

	case ir_binop_cross:
		check(op[0]->type == glsl_type::vec3_type || op[0]->type == glsl_type::half3_type);
		check(op[1] && (op[1]->type == glsl_type::vec3_type || op[1]->type == glsl_type::half3_type));
		data.f[0] = (op[0]->value.f[1] * op[1]->value.f[2]) - (op[0]->value.f[2] * op[1]->value.f[1]);
		data.f[1] = (op[0]->value.f[2] * op[1]->value.f[0]) - (op[0]->value.f[0] * op[1]->value.f[2]);
		data.f[2] = (op[0]->value.f[0] * op[1]->value.f[1]) - (op[0]->value.f[1] * op[1]->value.f[0]);
		break;

	case ir_binop_dot:
		data.f[0] = dot(op[0], op[1]);
		break;

	case ir_binop_min:
		check(op[1]);
		check(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
		for (unsigned c = 0, c0 = 0, c1 = 0;
			c < components;
			c0 += c0_inc, c1 += c1_inc, c++)
		{
			switch (op[0]->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.u[c] = MIN2(op[0]->value.u[c0], op[1]->value.u[c1]);
				break;
			case GLSL_TYPE_INT:
				data.i[c] = MIN2(op[0]->value.i[c0], op[1]->value.i[c1]);
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.f[c] = MIN2(op[0]->value.f[c0], op[1]->value.f[c1]);
				break;
			default:
				check(0);
			}
		}

		break;
	case ir_binop_max:
		check(op[1]);
		check(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
		for (unsigned c = 0, c0 = 0, c1 = 0;
			c < components;
			c0 += c0_inc, c1 += c1_inc, c++)
		{
			switch (op[0]->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.u[c] = MAX2(op[0]->value.u[c0], op[1]->value.u[c1]);
				break;
			case GLSL_TYPE_INT:
				data.i[c] = MAX2(op[0]->value.i[c0], op[1]->value.i[c1]);
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.f[c] = MAX2(op[0]->value.f[c0], op[1]->value.f[c1]);
				break;
			default:
				check(0);
			}
		}
		break;

	case ir_binop_add:
		check(op[1]);
		check(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
		for (unsigned c = 0, c0 = 0, c1 = 0;
			c < components;
			c0 += c0_inc, c1 += c1_inc, c++)
		{
			switch (op[0]->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.u[c] = op[0]->value.u[c0] + op[1]->value.u[c1];
				break;
			case GLSL_TYPE_INT:
				data.i[c] = op[0]->value.i[c0] + op[1]->value.i[c1];
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.f[c] = op[0]->value.f[c0] + op[1]->value.f[c1];
				break;
			default:
				check(0);
			}
		}

		break;
	case ir_binop_sub:
		check(op[1]);
		check(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
		for (unsigned c = 0, c0 = 0, c1 = 0;
			c < components;
			c0 += c0_inc, c1 += c1_inc, c++)
		{
			switch (op[0]->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.u[c] = op[0]->value.u[c0] - op[1]->value.u[c1];
				break;
			case GLSL_TYPE_INT:
				data.i[c] = op[0]->value.i[c0] - op[1]->value.i[c1];
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.f[c] = op[0]->value.f[c0] - op[1]->value.f[c1];
				break;
			default:
				check(0);
			}
		}

		break;
	case ir_binop_mul:
		/* Check for equal types, or unequal types involving scalars */
		check(op[1]);
		if ((op[0]->type == op[1]->type) || op0_scalar || op1_scalar)
		{
			for (unsigned c = 0, c0 = 0, c1 = 0;
				c < components;
				c0 += c0_inc, c1 += c1_inc, c++)
			{
				switch (op[0]->type->base_type)
				{
				case GLSL_TYPE_UINT:
					data.u[c] = op[0]->value.u[c0] * op[1]->value.u[c1];
					break;
				case GLSL_TYPE_INT:
					data.i[c] = op[0]->value.i[c0] * op[1]->value.i[c1];
					break;
				case GLSL_TYPE_HALF:
				case GLSL_TYPE_FLOAT:
					data.f[c] = op[0]->value.f[c0] * op[1]->value.f[c1];
					break;
				default:
					check(0);
				}
			}
		}
		break;
	case ir_binop_div:
		/* FINISHME: Emit warning when division-by-zero is detected. */
		check(op[1]);
		check(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
		for (unsigned c = 0, c0 = 0, c1 = 0;
			c < components;
			c0 += c0_inc, c1 += c1_inc, c++)
		{

			switch (op[0]->type->base_type)
			{
			case GLSL_TYPE_UINT:
				if (op[1]->value.u[c1] == 0)
				{
					data.u[c] = 0;
				}
				else
				{
					data.u[c] = op[0]->value.u[c0] / op[1]->value.u[c1];
				}
				break;
			case GLSL_TYPE_INT:
				if (op[1]->value.i[c1] == 0)
				{
					data.i[c] = 0;
				}
				else
				{
					data.i[c] = op[0]->value.i[c0] / op[1]->value.i[c1];
				}
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.f[c] = op[0]->value.f[c0] / op[1]->value.f[c1];
				break;
			default:
				check(0);
			}
		}

		break;
	case ir_binop_mod:
		/* FINISHME: Emit warning when division-by-zero is detected. */
		check(op[1]);
		check(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
		for (unsigned c = 0, c0 = 0, c1 = 0;
			c < components;
			c0 += c0_inc, c1 += c1_inc, c++)
		{
			switch (op[0]->type->base_type)
			{
			case GLSL_TYPE_UINT:
				if (op[1]->value.u[c1] == 0)
				{
					data.u[c] = 0;
				}
				else
				{
					data.u[c] = op[0]->value.u[c0] % op[1]->value.u[c1];
				}
				break;
			case GLSL_TYPE_INT:
				if (op[1]->value.i[c1] == 0)
				{
					data.i[c] = 0;
				}
				else
				{
					data.i[c] = op[0]->value.i[c0] % op[1]->value.i[c1];
				}
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				/* We don't use fmod because it rounds toward zero; GLSL specifies
				* the use of floor.
				*/
				data.f[c] = op[0]->value.f[c0] - op[1]->value.f[c1]
					* floorf(op[0]->value.f[c0] / op[1]->value.f[c1]);
				break;
			default:
				check(0);
			}
		}

		break;

	case ir_binop_logic_and:
		check(op[1]);
		check(op[0]->type->base_type == GLSL_TYPE_BOOL);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
			data.b[c] = op[0]->value.b[c] && op[1]->value.b[c];
		break;
	case ir_binop_logic_xor:
		check(op[0]->type->base_type == GLSL_TYPE_BOOL);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
			data.b[c] = op[0]->value.b[c] ^ op[1]->value.b[c];
		break;
	case ir_binop_logic_or:
		check(op[0]->type->base_type == GLSL_TYPE_BOOL);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
			data.b[c] = op[0]->value.b[c] || op[1]->value.b[c];
		break;

	case ir_binop_less:
		check(op[1]);
		check(op[0]->type == op[1]->type);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			switch (op[0]->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.b[0] = op[0]->value.u[0] < op[1]->value.u[0];
				break;
			case GLSL_TYPE_INT:
				data.b[0] = op[0]->value.i[0] < op[1]->value.i[0];
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.b[0] = op[0]->value.f[0] < op[1]->value.f[0];
				break;
			default:
				check(0);
			}
		}
		break;
	case ir_binop_greater:
		check(op[1]);
		check(op[0]->type == op[1]->type);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			switch (op[0]->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.b[c] = op[0]->value.u[c] > op[1]->value.u[c];
				break;
			case GLSL_TYPE_INT:
				data.b[c] = op[0]->value.i[c] > op[1]->value.i[c];
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.b[c] = op[0]->value.f[c] > op[1]->value.f[c];
				break;
			default:
				check(0);
			}
		}
		break;
	case ir_binop_lequal:
		check(op[1]);
		check(op[0]->type == op[1]->type);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			switch (op[0]->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.b[0] = op[0]->value.u[0] <= op[1]->value.u[0];
				break;
			case GLSL_TYPE_INT:
				data.b[0] = op[0]->value.i[0] <= op[1]->value.i[0];
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.b[0] = op[0]->value.f[0] <= op[1]->value.f[0];
				break;
			default:
				check(0);
			}
		}
		break;
	case ir_binop_gequal:
		check(op[1]);
		check(op[0]->type == op[1]->type);
		for (unsigned c = 0; c < op[0]->type->components(); c++)
		{
			switch (op[0]->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.b[0] = op[0]->value.u[0] >= op[1]->value.u[0];
				break;
			case GLSL_TYPE_INT:
				data.b[0] = op[0]->value.i[0] >= op[1]->value.i[0];
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.b[0] = op[0]->value.f[0] >= op[1]->value.f[0];
				break;
			default:
				check(0);
			}
		}
		break;
	case ir_binop_equal:
		check(op[1]);
		check(op[0]->type == op[1]->type);
		for (unsigned c = 0; c < components; c++)
		{
			switch (op[0]->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.b[c] = op[0]->value.u[c] == op[1]->value.u[c];
				break;
			case GLSL_TYPE_INT:
				data.b[c] = op[0]->value.i[c] == op[1]->value.i[c];
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.b[c] = op[0]->value.f[c] == op[1]->value.f[c];
				break;
			case GLSL_TYPE_BOOL:
				data.b[c] = op[0]->value.b[c] == op[1]->value.b[c];
				break;
			default:
				check(0);
			}
		}
		break;
	case ir_binop_nequal:
		check(op[1]);
		check(op[0]->type == op[1]->type);
		for (unsigned c = 0; c < components; c++)
		{
			switch (op[0]->type->base_type)
			{
			case GLSL_TYPE_UINT:
				data.b[c] = op[0]->value.u[c] != op[1]->value.u[c];
				break;
			case GLSL_TYPE_INT:
				data.b[c] = op[0]->value.i[c] != op[1]->value.i[c];
				break;
			case GLSL_TYPE_HALF:
			case GLSL_TYPE_FLOAT:
				data.b[c] = op[0]->value.f[c] != op[1]->value.f[c];
				break;
			case GLSL_TYPE_BOOL:
				data.b[c] = op[0]->value.b[c] != op[1]->value.b[c];
				break;
			default:
				check(0);
			}
		}
		break;
	case ir_binop_all_equal:
		check(op[1]);
		data.b[0] = op[0]->has_value(op[1]);
		break;
	case ir_binop_any_nequal:
		check(op[1]);
		data.b[0] = !op[0]->has_value(op[1]);
		break;

	case ir_binop_lshift:
		for (unsigned c = 0, c0 = 0, c1 = 0;
			c < components;
			c0 += c0_inc, c1 += c1_inc, c++)
		{

			check(op[1]);
			if (op[0]->type->base_type == GLSL_TYPE_INT &&
				op[1]->type->base_type == GLSL_TYPE_INT)
			{
				data.i[c] = op[0]->value.i[c0] << op[1]->value.i[c1];

			}
			else if (op[0]->type->base_type == GLSL_TYPE_INT &&
				op[1]->type->base_type == GLSL_TYPE_UINT)
			{
				data.i[c] = op[0]->value.i[c0] << op[1]->value.u[c1];

			}
			else if (op[0]->type->base_type == GLSL_TYPE_UINT &&
				op[1]->type->base_type == GLSL_TYPE_INT)
			{
				data.u[c] = op[0]->value.u[c0] << op[1]->value.i[c1];

			}
			else if (op[0]->type->base_type == GLSL_TYPE_UINT &&
				op[1]->type->base_type == GLSL_TYPE_UINT)
			{
				data.u[c] = op[0]->value.u[c0] << op[1]->value.u[c1];
			}
		}
		break;

	case ir_binop_rshift:
		for (unsigned c = 0, c0 = 0, c1 = 0;
			c < components;
			c0 += c0_inc, c1 += c1_inc, c++)
		{
			check(op[1]);
			if (op[0]->type->base_type == GLSL_TYPE_INT &&
				op[1]->type->base_type == GLSL_TYPE_INT)
			{
				data.i[c] = op[0]->value.i[c0] >> op[1]->value.i[c1];
			}
			else if (op[0]->type->base_type == GLSL_TYPE_INT &&
				op[1]->type->base_type == GLSL_TYPE_UINT)
			{
				data.i[c] = op[0]->value.i[c0] >> op[1]->value.u[c1];

			}
Esempio n. 17
0
fcomplex
csinhf(fcomplex z) {
	float		x, y, S, C;
	double		t;
	int		hx, ix, hy, iy, n;
	fcomplex	ans;

	x = F_RE(z);
	y = F_IM(z);
	hx = THE_WORD(x);
	ix = hx & 0x7fffffff;
	hy = THE_WORD(y);
	iy = hy & 0x7fffffff;
	x = fabsf(x);
	y = fabsf(y);

	sincosf(y, &S, &C);
	if (ix >= 0x41600000) {	/* |x| > 14 = prec/2 (14,28,34,60) */
		if (ix >= 0x42B171AA) {	/* |x| > 88.722... ~ log(2**128) */
			if (ix >= 0x7f800000) {	/* |x| is inf or NaN */
				if (iy == 0) {
					F_RE(ans) = x;
					F_IM(ans) = y;
				} else if (iy >= 0x7f800000) {
					F_RE(ans) = x;
					F_IM(ans) = x - y;
				} else {
					F_RE(ans) = C * x;
					F_IM(ans) = S * x;
				}
			} else {
#if defined(__i386) && !defined(__amd64)
				int	rp = __swapRP(fp_extended);
#endif
				/* return (C, S) * exp(x) / 2 */
				t = __k_cexp((double)x, &n);
				F_RE(ans) = (float)scalbn(C * t, n - 1);
				F_IM(ans) = (float)scalbn(S * t, n - 1);
#if defined(__i386) && !defined(__amd64)
				if (rp != fp_extended)
					(void) __swapRP(rp);
#endif
			}
		} else {
			t = expf(x) * half;
			F_RE(ans) = C * t;
			F_IM(ans) = S * t;
		}
	} else {
		if (ix == 0) {	/* x = 0, return (0,S) */
			F_RE(ans) = zero;
			F_IM(ans) = S;
		} else {
			F_RE(ans) = C * sinhf(x);
			F_IM(ans) = S * coshf(x);
		}
	}
	if (hx < 0)
		F_RE(ans) = -F_RE(ans);
	if (hy < 0)
		F_IM(ans) = -F_IM(ans);
	return (ans);
}
Esempio n. 18
0
__device__ inline float  occaCuda_fastCosh(const float x){  return coshf(x); }
Esempio n. 19
0
float pgeMathCosh(float x)
{
	return coshf(x);
}
Esempio n. 20
0
double cosh(double x)
{
  return coshf(x);
}
Esempio n. 21
0
static int testf(float float_x, long double long_double_x, /*float complex float_complex_x,*/ int int_x, long long_x)
{
int r = 0;
r += acosf(float_x);
r += acoshf(float_x);
r += asinf(float_x);
r += asinhf(float_x);
r += atan2f(float_x, float_x);
r += atanf(float_x);
r += atanhf(float_x);
/*r += cargf(float_complex_x); - will fight with complex numbers later */
r += cbrtf(float_x);
r += ceilf(float_x);
r += copysignf(float_x, float_x);
r += cosf(float_x);
r += coshf(float_x);
r += erfcf(float_x);
r += erff(float_x);
r += exp2f(float_x);
r += expf(float_x);
r += expm1f(float_x);
r += fabsf(float_x);
r += fdimf(float_x, float_x);
r += floorf(float_x);
r += fmaf(float_x, float_x, float_x);
r += fmaxf(float_x, float_x);
r += fminf(float_x, float_x);
r += fmodf(float_x, float_x);
r += frexpf(float_x, &int_x);
r += gammaf(float_x);
r += hypotf(float_x, float_x);
r += ilogbf(float_x);
r += ldexpf(float_x, int_x);
r += lgammaf(float_x);
r += llrintf(float_x);
r += llroundf(float_x);
r += log10f(float_x);
r += log1pf(float_x);
r += log2f(float_x);
r += logbf(float_x);
r += logf(float_x);
r += lrintf(float_x);
r += lroundf(float_x);
r += modff(float_x, &float_x);
r += nearbyintf(float_x);
r += nexttowardf(float_x, long_double_x);
r += powf(float_x, float_x);
r += remainderf(float_x, float_x);
r += remquof(float_x, float_x, &int_x);
r += rintf(float_x);
r += roundf(float_x);
#ifdef __UCLIBC_SUSV3_LEGACY__
r += scalbf(float_x, float_x);
#endif
r += scalblnf(float_x, long_x);
r += scalbnf(float_x, int_x);
r += significandf(float_x);
r += sinf(float_x);
r += sinhf(float_x);
r += sqrtf(float_x);
r += tanf(float_x);
r += tanhf(float_x);
r += tgammaf(float_x);
r += truncf(float_x);
return r;
}
Esempio n. 22
0
TEST(math, coshf) {
  ASSERT_FLOAT_EQ(1.0f, coshf(0.0f));
}
Esempio n. 23
0
 SIMDType<float, 1> operator()(const SIMDType<float, 1> a) { return coshf(a.mVal); }
float ICACHE_FLASH_ATTR __ieee754_coshf(float x) {
    return coshf(x);
}
Esempio n. 25
0
npy_float npy_coshf(npy_float x)
{
    return coshf(x);
}
Esempio n. 26
0
int main(int argc, char *argv[])
{
  float x;
  x = coshf((float) argc);
  return 0;
}
Esempio n. 27
0
inline float coshf2(float x) {
    return coshf(x);
}
Esempio n. 28
0
int main() {
	
	a = exp(a);
	b = expf(b);
	c = fastexp(c);
	d = fasterexp(c);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = log(a);
	b = logf(b);
	c = fastlog(c);
	d = fasterlog(c);
	printf("%f %f %f %f\n", a, b, c, d);	
	
	a = pow(a,a);
	b = pow(b,b);
	c = fastpow(c,c);
	d = fasterpow(c,c);
	printf("%f %f %f %f\n", a, b, c, d);			

	
	a = sin(a);
	b = sinf(b);
	c = fastsin(c);
	d = fastersin(c);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = cos(a);
	b = cosf(b);
	c = fastcos(c);
	d = fastercos(c);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = tan(a);
	b = tanf(b);
	c = fasttan(c);
	d = fastertan(c);
	printf("%f %f %f %f\n", a, b, c, d);	
	
	a = asin(a);
	b = asinf(b);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = acos(a);
	b = acosf(b);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = atan(a);
	b = atanf(b);
	printf("%f %f %f %f\n", a, b, c, d);	
	
	a = sinh(a);
	b = sinhf(b);
	c = fastsinh(c);
	d = fastersinh(c);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = cosh(a);
	b = coshf(b);
	c = fastcosh(c);
	d = fastercosh(c);
	printf("%f %f %f %f\n", a, b, c, d);
	
	a = tanh(a);
	b = tanhf(b);
	c = fasttanh(c);
	d = fastertanh(c);
	printf("%f %f %f %f\n", a, b, c, d);		
	
	a = lgamma(a);
	b = lgammaf(b);
	c = fastlgamma(c);
	d = fasterlgamma(c);
	printf("%f %f %f %f\n", a, b, c, d);		
	
	return 0;
	
}
Esempio n. 29
0
static void cosh_float(t_cosh *x, t_float f)
{
    /* CHECKME large values */
    outlet_float(((t_object *)x)->ob_outlet, x->x_value = coshf(f));
}
Esempio n. 30
0
__host__ void single_precision_math_functions()
{
    int iX;
    float fX, fY;

    acosf(1.0f);
    acoshf(1.0f);
    asinf(0.0f);
    asinhf(0.0f);
    atan2f(0.0f, 1.0f);
    atanf(0.0f);
    atanhf(0.0f);
    cbrtf(0.0f);
    ceilf(0.0f);
    copysignf(1.0f, -2.0f);
    cosf(0.0f);
    coshf(0.0f);
    //cospif(0.0f);
    //cyl_bessel_i0f(0.0f);
    //cyl_bessel_i1f(0.0f);
    erfcf(0.0f);
    //erfcinvf(2.0f);
    //erfcxf(0.0f);
    erff(0.0f);
    //erfinvf(1.0f);
    exp10f(0.0f);
    exp2f(0.0f);
    expf(0.0f);
    expm1f(0.0f);
    fabsf(1.0f);
    fdimf(1.0f, 0.0f);
    //fdividef(0.0f, 1.0f);
    floorf(0.0f);
    fmaf(1.0f, 2.0f, 3.0f);
    fmaxf(0.0f, 0.0f);
    fminf(0.0f, 0.0f);
    fmodf(0.0f, 1.0f);
    frexpf(0.0f, &iX);
    hypotf(1.0f, 0.0f);
    ilogbf(1.0f);
    isfinite(0.0f);
    isinf(0.0f);
    isnan(0.0f);
    ///j0f(0.0f);
    ///j1f(0.0f);
    ///jnf(-1.0f, 1.0f);
    ldexpf(0.0f, 0);
    ///lgammaf(1.0f);
    ///llrintf(0.0f);
    ///llroundf(0.0f);
    log10f(1.0f);
    log1pf(-1.0f);
    log2f(1.0f);
    logbf(1.0f);
    logf(1.0f);
    ///lrintf(0.0f);
    ///lroundf(0.0f);
    modff(0.0f, &fX);
    ///nanf("1");
    nearbyintf(0.0f);
    //nextafterf(0.0f);
    //norm3df(1.0f, 0.0f, 0.0f);
    //norm4df(1.0f, 0.0f, 0.0f, 0.0f);
    //normcdff(0.0f);
    //normcdfinvf(1.0f);
    //fX = 1.0f; normf(1, &fX);
    powf(1.0f, 0.0f);
    //rcbrtf(1.0f);
    remainderf(2.0f, 1.0f);
    remquof(1.0f, 2.0f, &iX);
    //rhypotf(0.0f, 1.0f);
    ///rintf(1.0f);
    //rnorm3df(0.0f, 0.0f, 1.0f);
    //rnorm4df(0.0f, 0.0f, 0.0f, 1.0f);
    //fX = 1.0f; rnormf(1, &fX);
    roundf(0.0f);
    //rsqrtf(1.0f);
    ///scalblnf(0.0f, 1);
    scalbnf(0.0f, 1);
    signbit(1.0f);
    sincosf(0.0f, &fX, &fY);
    //sincospif(0.0f, &fX, &fY);
    sinf(0.0f);
    sinhf(0.0f);
    //sinpif(0.0f);
    sqrtf(0.0f);
    tanf(0.0f);
    tanhf(0.0f);
    tgammaf(2.0f);
    truncf(0.0f);
    ///y0f(1.0f);
    ///y1f(1.0f);
    ///ynf(1, 1.0f);
}