Hi guys
I started C programming today, so this is a super simple question...
When writing mathematical operations, how do you use parenthesis () to make sure the operations are made in the right order?
The equation I want to write would be, in mathematical language,
x1 = x0 - (x0 * x0 * x0 - 3) / (3 * x * x)
where x0 is the initial value of x and x1 is the new value we are after.
So far in C, I am writing
x = x - (x*x*x - 3) / (3*x*x);
but this does not seem to give the proper result (e.g., if x0 = 1, I shoulg get x1 = 1.666667).
Why?
Thanks