replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Arguments of Min and Max
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Arguments of Min and Max

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
KL



Joined: 16 Nov 2009
Posts: 155

PostPosted: Wed Jul 20, 2011 12:49 pm    Post subject: Arguments of Min and Max Reply with quote

It seems that arguments of different types are accepted in the elemental functions Max and Min. If this is intended, I would suggest to give a warning if not all arguments have same type and kind parameter.

Best regards,

Klaus

Code:

Winapp
Program Test70

  Real             :: A_sp
  Double Precision :: A_dp
  Integer          :: A_i4

  A_sp = 1.0e+00
  A_dp = 5.0d+00
  A_i4 = 7

  Wert_max = Max ( A_sp, A_dp, A_i4 )
  Wert_min = Min ( A_sp, A_dp, A_i4 )

  Write (*,*) 'Wert_max = ', Wert_max, '  Wert_min = ', Wert_min

End Program Test70
Back to top
View user's profile Send private message
skeptic



Joined: 22 Mar 2009
Posts: 14

PostPosted: Wed Jul 20, 2011 3:14 pm    Post subject: Arguments of Min andMax Reply with quote

It depends on the order of the arguments?

Try I,R then D - correct!
but R,D and I - incorrect
Back to top
View user's profile Send private message
skeptic



Joined: 22 Mar 2009
Posts: 14

PostPosted: Wed Jul 20, 2011 5:32 pm    Post subject: Arguments of Min and Max Reply with quote

Klaus, which version are you using?

Using v5.0.0, I have tried all permutations (of Integer, Single and Double)
and all yield the correct answers.
Back to top
View user's profile Send private message
KL



Joined: 16 Nov 2009
Posts: 155

PostPosted: Thu Jul 21, 2011 7:24 am    Post subject: Reply with quote

The standard says that "all arguments must have the same type and kind type parameters. This is also said in FTN95's help. Such coding as given in the example may not be accepted by other compilers and reduces the portability, although the "correct" answer is given.

Klaus
Back to top
View user's profile Send private message
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Thu Jul 21, 2011 7:39 pm    Post subject: Reply with quote

They should be of the same type (and kind) as KL says.
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group