Woo, I hope that fixes your issue.
*AHelper awaits Graph3DP updates
*AHelper awaits Graph3DP updates
node->number.nN = (x == 0 || x == 1)?x:powf(x,0.5);
-((100-X^2-Y^2)^0.5)
-1*((100-X^2-Y^2)^0.5)
while (x > PI) x-=(2.f*PI);
while (x < -PI) x+=(2.f*PI);
if (x > PI) {
x += PI;
x -= (2.f*PI)*floor(x/(2.f*PI))
x -= PI;
}
if (x < -PI) {
x = (-x) + PI;
x -= (2.f*PI)*floor(x/(2.f*PI))
x = -(x-PI);
}
// Degree flag.
if (flags & lDegree)
x *= (180.f/PI);
if (node->type == nNUMBER) {
ret = gcas_alg_constant_simp(n, flags, vars, vars_length);
ret = gcas_alg_power_simp(node, flags);
return ret;
}
unsigned char gcas_alg_constant_simp(cas_node** n, cas_eval_level flags, cas_var* vars, unsigned int vars_length) {
if ((flags & lApprox) && ((*n)->number.nB != 0)) {
cas_node *thisvar = *n, *newnode = NULL;
//printf("Turning a variable (#%d, named %s, with n1 at %p) into a constant.\n",(*n)->number.nB,vars[thisvar->number.nB].name,vars[thisvar->number.nB].n1);
if (NULL == (newnode = (cas_node*)malloc(sizeof(cas_node)))) {
//printf("Malloc failed\n");
*n = thisvar; //undo what we just did, for safety
return 0;
}
//printf("Malloc succeeded, at %p.\n",*n);
*n = newnode;
(*n)->type = nNUMBER;
(*n)->number.nP = vars[thisvar->number.nB].n1->number.nP;
(*n)->number.nN = vars[thisvar->number.nB].n1->number.nN;
(*n)->number.nB = 0;
//printf("Turned a variable into a constant.\n");
return 1;
}
return 1;
}
@@ -1247,13 +1255,12 @@
}
else if(node->type != nFUNCTION)
{
- if (gcas_tree_eval_step(&node->n1,vars,vars_length, flags))
- return true;
+ ret = (gcas_tree_eval_step(&node->n1,vars,vars_length, flags));
if (node->type != nFACT)
- if (gcas_tree_eval_step(&node->n2,vars,vars_length, flags))
- return true;
- return false;
+ ret &= (gcas_tree_eval_step(&node->n2,vars,vars_length, flags));
+ return ret;
}
+
return false;
}
void gcas_tree_eval(cas_node **tree,cas_var *vars, unsigned int vars_length, cas_eval_level flags)
@@ -1701,10 +1708,9 @@
Advertisement