mckenney@acf2.NYU.EDU (Alan Michael McKenney) (03/20/89)
[Please respond to the E-mail address at the *end* of this article, and **NOT** to the address in the article header. The news posting mechanism on my home machine is, as always, broken, so I have to use a different one to post.] A question on the 1977 FORTRAN standerd with respect to COMPLEX variables: are COMPLEX data required to be stored as a pair of REAL data? The standard (page 4-4) says "The representation of a complex datum is in the form of an ordered pair of real data. ... Each part has the same degree of approximation as for a real datum." It is not clear to me from this whether each part has to have the same (exact) representation as a REAL datum. Every implementation I have ever seen has done this, but it is conceivable that someone, somewhere, will do it different if it is allowed (and perhaps for a good reason.) The situation where it comes up is: we have a routine which has various scalar arguments, some of which are REAL, but in most cases where it will be called, the caller will have a COMPLEX variable with zero imaginary part to pass. It would be simpler to just write in the COMPLEX variable, rather than always have to cast it to REAL. If (as it is for most implementations) the COMPLEX variable is stored as a REAL array, then the callee will just get the first element of that array, which will be a perfectly good REAL number which is the real part of the complex number. However, we want to be sure that we don't get bitten somewhere down the road if our code gets to a machine which uses a different represenation for the parts of a COMPLEX number that for a REAL. And yes, I know, there are other ways to do this. Please send E-mail, and I will summarize. Alan McKenney E-mail: mckenney@acf8.nyu.edu (INTERNET) Courant Institute,NYU ...!uunet!cmcl2!acf8!mckenney (UUCP) -- Alan McKenney E-mail: mckenney@acf8.nyu.edu (INTERNET) Courant Institute,NYU ...!uunet!cmcl2!acf8!mckenney (UUCP)