I need to calculate the following formula within an sql statement:
--Tsat = Ax + B/x + C(x^0.5) + D(ln(x)) + E(x^2) + F(x^3) + G
My first attempt is like so:
Local a real;
Local b real;
Local c real;
Local d real;
Local e real;
Local f real;
Local g real;
Local Tsat real;
Local P real;
a = -0.17724;
b = 3.83986;
c = 11.48345;
d = 31.1311;
e = 8.76E-05;
f = -2.79E-08;
g = 86.594;
P = 584.944;
Tsat = (a*P) + (b/P) + c*(P*exp(0.05)) + (d*(ln(P))) + e*(P*exp(2)) + f*(P*exp(3)) + g;
I do not get an error when I run this but the answer comes up wrong. If P = 584.944 then Tsat should equal 483.4151. This formula works correctly in excel so I know the formula is correct. Can anyone see where I went wrong in my formula?
Thanks,
Dave
--Tsat = Ax + B/x + C(x^0.5) + D(ln(x)) + E(x^2) + F(x^3) + G
My first attempt is like so:
Local a real;
Local b real;
Local c real;
Local d real;
Local e real;
Local f real;
Local g real;
Local Tsat real;
Local P real;
a = -0.17724;
b = 3.83986;
c = 11.48345;
d = 31.1311;
e = 8.76E-05;
f = -2.79E-08;
g = 86.594;
P = 584.944;
Tsat = (a*P) + (b/P) + c*(P*exp(0.05)) + (d*(ln(P))) + e*(P*exp(2)) + f*(P*exp(3)) + g;
I do not get an error when I run this but the answer comes up wrong. If P = 584.944 then Tsat should equal 483.4151. This formula works correctly in excel so I know the formula is correct. Can anyone see where I went wrong in my formula?
Thanks,
Dave