Paul,
I had some trouble with this and I finally got it to work though it wasn't pretty.
This works:
...
TPhiT = TanD(45+NewPhi/2);
Q3t = 4 * Q11 * (TPhiT^1.5-1)/(TPhiT^2-1) / 3; // Stress 3, Zone t
...
This didn't work:
...
Q3t = 4/3*Q11*((TanD(45+PhiNew/2))^1.5-1) / ((TanD(45+PhiNew/2))^2-1); // Stress 3, Zone t
...
Near as I can figure it, there was at least one may be two problems. The 4/3*Q1 part didn't seem to calc out correctly and I think there was a problem with the (TanD(45+PhiNew/2))^1.5 part. I don't know if the calculation became too large for a single line or if the compiler messed up on the order of operations. I monkeyed around with parenthesis to no avail.
4/3 = 1 if you don't force elevation to float or double. It is explained fairly well in the Emergence manual, just not in the Aurora guide yet. The compiler always picks the highest precision of the operands in a mathematical operation for the result type.
4/3 = Integer result
4/3.0 = double result
4.0/3 = double result
4/3f = float result
Precedence is listed in the tutorial, TPhiT is a double type so the left hand of your working equation becomes a double type. The the /3 comes last and the result is a double.
Equations are evaluated in order of parenthsis, precedence, and then left to right.
Paul.
o.k., thanks for the explanation. I was really going nuts trying to find the error in my results. I kept looking at the equations and everything looked o.k. but it didn't come out right. I'll have to chase though some 4000 lines of code now and make sure that same kind of error isn't elsewhere.
Can you add something like the f for doubles? like 4d?
I could but just the 4.0 makes it a double without a modifier ;)
I have a lot of equation like:
double someDouble;
someOtherDoble = someDouble^2;
Should the 2 be a 2.0?
no. ^ is a double precision operator. The result is always a double.
It is usually only division where you would need to be concerned about it.
thanks Paul