Le 16/11/2023 à 21:01, Steven G. Kargl a écrit :
>>
>> The reason is maybe because the standard doesn't specify how a complex
>> number is internally represented. In practice it is always represented
>> by a pair (real,imag), but nothing would prevent a compiler representing
>> it by (module,argument) for instance. Given that, the standard cannot
>> guarantee the absence of rounding errors.
>
> You are correct that the Fortran standard does not specify
> internal datails, and this could be extended to COMPLEX.
> It would however be quite strange for a Fortran vendor to
> use magnitude and phase
I fully agree that it would be strange, and I can't see any advantage to
such implementation. Yet, it is not prohibited by the standard.
> given that the Fortran standard does
> quite often refer to the real and imaginary parts of a COMPLEX
> entity.
Yes, but it's at the conceptual level
> Not to mention, the Fortran standard has introduced:
>
> 3.60.1
> complex part designator
>
> 9.4.4 Complex parts
>
> R915 complex-part-designator is designator % RE
> or designator % IM
Yes again, but behind the hood c%re and c%im could be the functions
m*cos(p) and m*sin(p). And on assignement c%re = <expr> or c%im = <expr>
the (m,p) pair could be fully recomputed.
> PS: If a Fortran vendor used magnitude and phase, then the vendor
> would need to specify a sign convention for the phasor. I'm mpt
> aware of any vendor that does.
I don't think so, as the phase component would not be directly
accessible by the user. The vendor could choose any convention as long
as the whole internal stuff is consistent, he could also chose to store
a scaled version of the phase in order to have a better accuracy...
--
"...sois ouvert aux idées des autres pour peu qu'elles aillent dans le
même sens que les tiennes.", ST sur fr.bio.medecine
ST passe le mur du çon : <
j3nn2h...@mid.individual.net>