To: J3 08-293r1 From: Dan Nagle Subject: COMPLEX intrinsic Date: 2008 November 17 References: N1723/08-007r2, 08-266r1 ----------- Discussion: The new COMPLEX intrinsic function proposed in 08-266r1 is of the form COMPLEX (RE, IM) where RE and IM are type real and have the same kind. Based on feedback from compiler writers and users, it would be better to relax the restrictions on the arguments so that they matched the requirements for the real and imaginary parts of a complex literal constant [54:4.4.4 Complex type, p4-p5]. RE and IM could be real or integer, and have different kind values. This provides better consistency in the standard, makes COMPLEX seem more like a type value constructor which is easy for the user to understand, and avoids problems that arise when one of the arguments is a literal constant and the code is compiled with an "-r8" option. This paper supersedes 08-266r1. Edits: [317 after COMMAND_ARGUMENT_COUNT] "COMPLEX (RE, IM) E Conversion to complex type." [337 after 13.7.37] "13.7.37+ <> <> Conversion to complex type. <> Elemental function. <> RE shall be of type real or type integer. IM shall be of type real or type integer. <> Case (i): Both RE and IM are type real, the result kind is the kind of RE or IM with the greater precision. Case (ii): One of RE and IM is type real and the other is type integer, the result kind is the kind of whichever of RE or IM is of type real. Case (iii): Both RE and IM are type integer, the result kind is the default real kind. <> The complex number with real part RE and imaginary part IM. Conversion, if necessary, is as if by intrinsic assignment to the real kind of the result. <> COMPLEX(A, B) is (3.0, 4.5) if A has the value 3.0 and B has the value 4.5."