Example #1
0
static inline T op1_impl(Op op, T x) {
	switch (op) {
	case OP_NEG:   return neg_impl(x);
	case OP_INV:   return inv_impl(x);
	case OP_SQ:    return sq_impl(x);
	case OP_CU:    return cu_impl(x);
	case OP_SQRT:  return sqrt_impl(x);
	case OP_SIN:   return sin_impl(x);
	case OP_COS:   return cos_impl(x);
	case OP_TAN:   return tan_impl(x);
	case OP_ASIN:  return asin_impl(x);
	case OP_ACOS:  return acos_impl(x);
	case OP_ATAN:  return atan_impl(x);
	case OP_SINH:  return sinh_impl(x);
	case OP_COSH:  return cosh_impl(x);
	case OP_TANH:  return tanh_impl(x);
	case OP_ASINH: return asinh_impl(x);
	case OP_ACOSH: return acosh_impl(x);
	case OP_ATANH: return atanh_impl(x);
	case OP_EXP:   return exp_impl(x);
	case OP_LOG:   return log_impl(x);
	case OP_ERF:   return erf_impl(x);
	case OP_ERFC:  return erfc_impl(x);
	case OP_ABS:   return abs_impl(x);
	case OP_FLOOR: return floor_impl(x);
	case OP_CEIL:  return ceil_impl(x);
	case OP_ROUND: return round_impl(x);
	case OP_TRUNC: return trunc_impl(x);
	default:       throw std::invalid_argument("Wrong number of arguments for operator");
	}
}
Example #2
0
		constexpr double asin_impl(double x, int n, int nmax){
			return n >= nmax? 1.0: 1.0+x*x*(n+1)*(n+1)/((n+2)*(n+3))*asin_impl(x, n+2, nmax);
		}