I am having a terrible time wrestling with my program.
I finally found that the bug could be found if there were a mechanism which
finds floating point exception "NaN"---yeah! The famous "NaN"---which is
*allowed* to be *undetected* by ANSI FORTRAN 77 Standard. Am I correct?
It seems that the MIPS f77 compiler which is used by DEC in their DecStations.
does not have floating-point-exception detection mechanism
in accordance with ANSI FORTRAN 77 Standard. Arrrrgggg....
I do not understand why ANSI did not specify such mechanism.
If you know why, please enlighten me. Is this kind of thing specified in
FORTRAN 9x?
I know a lot of compiler vendors implemented such detection meachanism
in their product.
Thanks.
-hsong-
nvuxl!hs...@bellcore.bellcore.com
PS: You need to type "nvuxl\!hsong@..." on Csh command line.
Why is there no way to detect "NaN" status in ANSI FORTRAN 77?
Well, for starters there was no IEEE 754 back then.
I finally found that the bug could be found if there were a mechanism which
finds floating point exception "NaN"---yeah! The famous "NaN"---which is
*allowed* to be *undetected* by ANSI FORTRAN 77 Standard. Am I correct?
IEEE 754 default mode is to not trap on "exceptions", however
exception handling is under user control. On Suns, for example,
ieee_handler("set","common",%val(2)) would have done the trick. I am
sure there is something nearly equally simple on your decstation.
If you know why, please enlighten me. Is this kind of thing specified in
FORTRAN 9x?
Alas no. Language committees still mostly punt on FP issues. There is
a "languague compatible floating point" standard working its way
through ANSI; however it was cleverly crafted to permit all the sins
that IEEE 754 outlawed, so I don't think it will be terribly useful.
--
----------------------------------------------------------------
Keith H. Bierman kbie...@Eng.Sun.COM | k...@chiba.Eng.Sun.COM
SMI 2550 Garcia 12-33 | (415 336 2648)
Mountain View, CA 94043
> . . . The famous "NaN"---which is
> *allowed* to be *undetected* by ANSI FORTRAN 77 Standard. Am I correct?
No. Fortran constrains but does not define the real arithmetic.
Questions like these are simply not addressed by Fortran.
> If you know why, please enlighten me. Is this kind of thing specified in
> FORTRAN 9x?
>
>Alas no. Language committees still mostly punt on FP issues. There is
As well they should. There are many issues which are not part of a language
definition, and instead should be factorred into different standards.
IEEE arithmetic is merely one possible model for real arithmetic. Some
machines implement very different models which are still valid for Fortran.
Perhaps someday there will be a model that blows IEEE away and is still
valid for Fortran. By separating the algebra from the model, Fortran maintains
a degree of machine independence. (Which was the purpose of standards when
I was younger--a standard algebra, not a standard model.)
The same factorring occurs in integer arithmetic, character set, IO
interfaces, libraries, memory allocation, ...
--
...!uunet!ingr!apd!smryan Steven Ryan
...!{apple|pyramid}!garth!smryan 2400 Geng Road, Palo Alto, CA