Board index » delphi » not enough actual parameters

not enough actual parameters


2005-11-23 12:55:27 AM
delphi1
Why do I get "not enough actual parameters" error for 2nd line (where I try
to power to 2 a simple minus equation .
If Dayii=BEG_Day-7 then
EBegDay_7:=power((power(Rad-Radii),2)+(power(Tmax-Tmaxii),2))+(power(Tmin-Tminii),2)+(power(Rain-Rainii),2)),0.5);
else If Dayii=BEG_Day-6 then
Thanks for help
 
 

Re:not enough actual parameters

Darius writes:
Quote
Why do I get "not enough actual parameters" error for 2nd line (where I try
to power to 2 a simple minus equation .

If Dayii=BEG_Day-7 then
EBegDay_7:=power((power(Rad-Radii),2)+(power(Tmax-Tmaxii),2))+(power(Tmin-Tminii),2)+(power(Rain-Rainii),2)),0.5);
else If Dayii=BEG_Day-6 then
You get that error because you're not passing enough parameters to one
of the functions. Look very carefully at each function call. How many
parameters does the Power function expect, and how many do you give to it?
You might find it easier if you split that very long expression into
several shorter ones.
--
Rob
 

Re:not enough actual parameters

"Darius" <XXXX@XXXXX.COM>writes
Quote
Why do I get "not enough actual parameters" error for 2nd line (where I
try
to power to 2 a simple minus equation .

If Dayii=BEG_Day-7 then

EBegDay_7:=power((power(Rad-Radii),2)+(power(Tmax-Tmaxii),2))+(power(Tmin-Tm
inii),2)+(power(Rain-Rainii),2)),0.5);
Explode the mess:
EBegDay_7:=power(base,exponent);
base:=
power(Rad-Radii),2)+(power(Tmax-Tmaxii),2))+(power(Tmin-Tminii),2)+(power(Ra
in-Rainii),2))
exponent=0.5
Now you can see that the base, which I guess is supposed to be four terms
added together, has mismatched brackets round the terms, leading to the
compiler rejecting the first term because 'power(Rad-Radii)' has only one
parameter.
Quote
else If Dayii=BEG_Day-6 then
Spurious 'else' because of the semicolon afer the 'if' above.
Like Rob says, try not to write complex expressions. it is not only
difficult to understand, it is difficult to debug because you have no
intermediate results. The compiler will optimize multiple statements, so
write the code as if you want someone else to debug it in a years time when
some problem appears. If your prof/tutor has any remarks, they will likely
then be 'clear and understandable expressions' and will earn extra marks.
An error in a complex, multi-term expression will just be dumped by your
tutor as timewasting garbage.
Note also that there is a 'Sqrt' function. Again, this is clearer than
raising a value to the power of 0.5, no matter whether they result in the
same code being called or not.
Rgds,
Martin