コード例 #1
0
ファイル: parse.c プロジェクト: cwoz117/c411_compilers
//TODO PRobably a problem here
static NODE * exp(void){
	NODE * t = new_exp(N_OP);
	if (t != NULL){
		t->child[0] = exp_helper();
		t->attribute.token_class = token.type;
	}
	match(token.type); // ADD or SUB
	if (t != NULL){
		t->child[1] = exp_helper();
	}
}
コード例 #2
0
// exp_const(x) = e^n . e^r (where n is an integer, and -0.5 > r < 0.5
// exp_const(r) = e^r = 1 + r + r^2/2 + r^3/6 + r^4/24 + r^5/120
constexpr double exp_const(const double x) {
    return pow_const(M_E, nearest_const(x)) * exp_helper(fraction_const(x));
}