single to double conversion
Richard E Maine
Richard.Maine@nasa.gov
Wed Sep 27 19:57:00 GMT 2006
On Sep 27, 2006, at 12:35 PM, Steve Kargl wrote:
> The author of g77 made the decide to use the f2c runtime library.
> f2c always promotes a single precision function to double
> precision.
I don't see an obvious way to do that and still conform to the
Fortran standard. Perhaps I am missing a trick. Or perhaps g77 just
fails to conform to the Fortran standard there. Having a compiler
switch to enable a nonconforming behavior is one thing. But having a
compiler that did not even have the option to conform to the standard
strikes me as.... um.... problematic.
The nonconformance might not show up in most codes, but it sure isn't
hard to come up with a case of valid Fortran code that would fail
under such an implementation. Consider
call sub(f(x))
where f(x) returns a (single precision) real, and sub has a (single
precision) real dummy argument. If f(x) is implemented to return a
double instead of a single, then its result isn't going to be valid
as an actual argument for sub. But if sub is separately compiled,
there won't be an opportunity for the compiler to detect or fix the
problem.
Perhaps I'm misunderstanding what was going on here, but I'm at least
a little suspicious that you've just described a way in which g77
violates the standard (which is different from extending it).
--
Richard Maine | Good judgment comes from experience;
Richard.Maine@nasa.gov | experience comes from bad judgment.
| -- Mark Twain
More information about the Fortran
mailing list