[esp-r] Re: invalid type combination
Ferguson, Alex
Alex.Ferguson at NRCan-RNCan.gc.ca
Fri Mar 6 14:56:15 GMT 2009
Hi Leen,
I think you mean to write your if-test as follows:
IF(Q.lt.0-0.05.AND.T.eq.1.AND.G.eq.2)THEN
(note that the 'lt' comparison operator should be terminated with a '.'.
I think this is probably the source of your error.)
In this case, '0' is a integer, and you're relying the compiler to
implicitly cast it as a real. Most compilers will do this reliably, but
it's better to retype your '0' as a real:
IF ( Q .lt. (0.-0.05) .AND.
& T .eq. 1 .AND.
& G .eq. 2 ) THEN
If you're not working with legacy code, please consider using clear
variable names so that other developers do not need to guess at the
meaning of 'Q', 'T' and 'G'. Hungarian notation can make the type of
variables even clearer; when I first read your question, I assumed T
must be temperature and therefore a real. You might use a convention
like the following:
Q -> fQHeatFlux
T -> iType
G -> iGSomeOtherName
It seems a little pedantic at first, but I find that once you adapt to
Hungarian notation, it's hard to keep your types straight without it!
Finally, the developer's list is probably a better forum for questions
like these. Let me know if you have trouble posting to it.
Cheers,
- Alex
Alex Ferguson
Sustainable Buildings and Communities (Housing Group)
CanmetENERGY
Natural Resources Canada
P:+1 613 995 3294
F:+1 613 996 9909
Alex.Ferguson at NRCan-RNCan.gc.ca
-----Original Message-----
From: esp-r-bounces at lists.strath.ac.uk
[mailto:esp-r-bounces at lists.strath.ac.uk] On Behalf Of Leen Peeters
Sent: March 5, 2009 16:38
To: esp-r at lists.strath.ac.uk
Subject: [esp-r] invalid type combination
Dear,
going through the debugger I get the following message
invalid type combination in ordering comparison
when evaluating a case like
IF(Q.lt-0-0.05.AND.T.eq.1.AND.G.eq.2)THEN
where Q is a real and T and G are integers
Can anyone explain me why?
I does not seem to help to add brackets around the value -0.05...
Leen
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
_______________________________________________
esp-r mailing list
esp-r at lists.strath.ac.uk
http://lists.strath.ac.uk/mailman/listinfo/esp-r
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.strath.ac.uk/archives/esp-r/attachments/20090306/60f14173/attachment.html
More information about the esp-r
mailing list