[Aces-support] Odd F90 Question
Tim Whitcomb
ude_tim at MIT.EDU
Mon Oct 15 14:51:18 EDT 2007
Hi ACES folks:
This isn't necessarily a question about the ACES cluster, but there are
many more skilled with Fortran 90 than me on this list, so this is
submitted for your consideration.
I have a snippet of code that is giving some interesting numeric
(integer!) results:
--------------------
...
trim_size = size(trim_data)
write (*,*) "Size of trim_data is :", size(trim_data)
write (*,*) "Four times that is (?) :", 4 * size(trim_data)
write (*,*) "4x stored integer is :", 4 * trim_size
...
--------------------
trim_data is a real*4 array declared as
trim_data(min_lat:max_lat,min_lon:max_lon),
where m??_l?? are declared as integer, parameter with values 0,13,180,220.
when I run this, I get the following result:
--------------------
Size of trim_data is : 574
Four times that is (?) : 2012
4x stored integer is : 2296
--------------------
So, storing size(trim_data) in a separate integer variable and
multiplying gives a different answer than just doing the explicit
multiplication. An unbiased third electronic vote, my calculator,
claims that 4 * 574 is indeed 2296.
No doubt that this is probably something simple that I am missing, but
I've stared at this too long. Any ideas? I hope I have included all
relevant information - this is built using pgf90 on a54-1727-032.
Tim
--
Timothy R. Whitcomb
===========================================
Research Assistant
Program on Atmospheres, Oceans, and Climate
Massachusetts Institute of Technology
office: Room 54-1611
77 Massachusetts Avenue
Cambridge, MA 02139
email: ude_tim at mit.edu
===========================================
More information about the Aces-support
mailing list