Silverfrost Forums

Welcome to our forums

Arguments of Min and Max

20 Jul 2011 11:49 #8596

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

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
20 Jul 2011 2:14 #8598

It depends on the order of the arguments?

Try I,R then D - correct! but R,D and I - incorrect

20 Jul 2011 4:32 #8599

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.

21 Jul 2011 6:24 #8602

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

21 Jul 2011 6:39 #8604

They should be of the same type (and kind) as KL says.

Please login to reply.