I am presently comparing several correlations with regard to accuracy and CPU time. For the determination of the CPU time I use the Plato option “Plant timing information”. During this comparison I have got the effect that LOG(y1) in one FUNCTION requires more CPU time than LOG(y1) in another FUNCTION although in both cases y1 is an already calculated variable.
The effect in detail: Below are the FUNCTIONs ONE and TWO that differ only in the lines 'z=...' and 'x1=...' in ONE and 'x2=...' in TWO. At the end of both FUNCTIONs LOG(y1) is called. The CPU times are 78,6 nsec for ONE and 71,0 nsec for TWO, i.e. ONE needs about 11% more CPU time than TWO, although the numerical effort is almost the same (12 basic algebraic operations in ONE versus 13 in TWO).
FUNCTION one(R,K)
.....
.....
z = CKiZ*K+AR*Cz
X1 = ((Ap2*z+Ap1)*z+Ap0)/((Bp2*z+Bp1)*z+Bp0)
Y1 = AR*X1+AK
one = LOG(Y1)
END FUNCTION one
FUNCTION two(R,K)
.....
.....
X2 = B0+C0*k+(R*N2+N1)*R/(((k*Dk+D2)*R+D1)*R+D0)
Y1 = AR*X2+AK
two = LOG(Y1)
END FUNCTION two
In order to further analyse this effect I have written the FUNCTIONs ONE1 and TWO1 below, which are identical to ONE and TWO besides the LOG functions at the end, that have been removed.
FUNCTION one1(R,K)
.....
.....
z = CKiZ*K+AR*Cz
X1 = ((Ap2*z+Ap1)*z+Ap0)/((Bp2*z+Bp1)*z+Bp0)
Y1 = AR*X1+AK
one1= Y1
END FUNCTION one1
FUNCTION two1(R,K)
.....
.....
X2 = B0+C0*k+(R*N2+N1)*R/(((k*Dk+D2)*R+D1)*R+D0)
Y1 = AR*X2+AK
two1= Y1
END FUNCTION two1
The CPU times are 26,8 nsec for ONE1 and 26,5 nsec for TWO1, i.e. ONE1 needs about 1% more CPU time than TWO1. This confirms my estimation that the numerical effort for the differences in ONE and TWO is about the same. This also means to me, with view to the FUNCTIONs ONE and TWO, that up to the lines 'y1=...' both FUNCTIONs need the same CPU time and that LOG(y1) in ONE requires more CPU time than LOG(y1) in TWO. What is a possible explanation for this effect? How can I get rid of it?