Discussion:
ieee_arithmetic
(too old to reply)
Herman D. Knoble
2006-08-25 13:41:09 UTC
Permalink
In Fortran 95/2003 Explained, Section 11.93 Elemental functions
indicates a use statement: use ieee-arithmetic

Thus, for example, one might test the 2003 elemental function
ieee_is_nan using a program like:

program testisnan
use ieee_arithmetic
real :: x
x=1
if (ieee_is_nan(x) ) then
print *, "X is NaN"
else
print *, "X is NOT NaN"
endif

end program testisnan


Question: Does anyone know of a Fortran Compiler which
implements this ieee environment (use and functions)?

Many thanks.
Skip Knoble
Rich Townsend
2006-08-25 14:02:39 UTC
Permalink
Post by Herman D. Knoble
In Fortran 95/2003 Explained, Section 11.93 Elemental functions
indicates a use statement: use ieee-arithmetic
Thus, for example, one might test the 2003 elemental function
program testisnan
use ieee_arithmetic
real :: x
x=1
if (ieee_is_nan(x) ) then
print *, "X is NaN"
else
print *, "X is NOT NaN"
endif
end program testisnan
Question: Does anyone know of a Fortran Compiler which
implements this ieee environment (use and functions)?
Many thanks.
Skip Knoble
Good question. And it would be nice to see the information incorporated in
Polyhedron's comparison matrix.

cheers,

Rich
themos
2006-08-25 15:17:20 UTC
Permalink
Post by Herman D. Knoble
In Fortran 95/2003 Explained, Section 11.93 Elemental functions
indicates a use statement: use ieee-arithmetic
Thus, for example, one might test the 2003 elemental function
program testisnan
use ieee_arithmetic
real :: x
x=1
if (ieee_is_nan(x) ) then
print *, "X is NaN"
else
print *, "X is NOT NaN"
endif
end program testisnan
Question: Does anyone know of a Fortran Compiler which
implements this ieee environment (use and functions)?
Many thanks.
Skip Knoble
It seems that the NAGWare compiler has supported this since Release 5.0

http://www.nag.com/nagware/np/r50_doc/ieee_arithmetic.html

and

http://www.nag.com/nagware/np/doc_index.asp
Herman D. Knoble
2006-08-25 16:42:08 UTC
Permalink
Themos: Thanks. How about running the example that I posted
(below) to make certain it runs and displays: X is NOT a NaN

Skip

On 25 Aug 2006 08:17:20 -0700, "themos" <***@nag.co.uk> wrote:

-|Herman D. Knoble wrote:
-|> In Fortran 95/2003 Explained, Section 11.93 Elemental functions
-|> indicates a use statement: use ieee-arithmetic
-|>
-|> Thus, for example, one might test the 2003 elemental function
-|> ieee_is_nan using a program like:
-|>
-|> program testisnan
-|> use ieee_arithmetic
-|> real :: x
-|> x=1
-|> if (ieee_is_nan(x) ) then
-|> print *, "X is NaN"
-|> else
-|> print *, "X is NOT NaN"
-|> endif
-|>
-|> end program testisnan
-|>
-|>
-|> Question: Does anyone know of a Fortran Compiler which
-|> implements this ieee environment (use and functions)?
-|>
-|> Many thanks.
-|> Skip Knoble
-|
-|It seems that the NAGWare compiler has supported this since Release 5.0
-|
-|http://www.nag.com/nagware/np/r50_doc/ieee_arithmetic.html
-|
-|and
-|
-|http://www.nag.com/nagware/np/doc_index.asp
themos
2006-08-29 12:15:10 UTC
Permalink
Post by Herman D. Knoble
Themos: Thanks. How about running the example that I posted
(below) to make certain it runs and displays: X is NOT a NaN
Skip
***@loanamd16>cat -n testisnan.f90 ;
/users/systems/nag/bin.linux/f95 -V ~/testisnan.f90 ; ./a.out ; file
a.out ; ldd a.out
1 program testisnan
2 use ieee_arithmetic
3 real :: x
4 x=1
5 if (ieee_is_nan(x) ) then
6 print *, "X is NaN"
7 else
8 print *, "X is NOT NaN"
9 endif
10 end program testisnan
NAGWare Fortran 95 compiler Release 5.0(382)
Copyright 1990-2004 The Numerical Algorithms Group Ltd., Oxford, U.K.
f95comp version is 5.0(382)
X is NOT NaN
a.out: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), not stripped
libf96.so.1 =>
/users/systems/nag/lib.linux/f95_r50_rh7_64/lib/libf96.so.1
(0x0000002a9566a000)
libm.so.6 => /lib64/libm.so.6 (0x0000002a95afe000)
libc.so.6 => /lib64/libc.so.6 (0x0000002a95c56000)
/lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2
(0x0000002a95556000)

Richard Maine
2006-08-25 18:59:03 UTC
Permalink
Post by Herman D. Knoble
In Fortran 95/2003 Explained, Section 11.93 Elemental functions
indicates a use statement: use ieee-arithmetic
...
Post by Herman D. Knoble
Question: Does anyone know of a Fortran Compiler which
implements this ieee environment (use and functions)?
I don't have a handy list, but it was my unverified impression that
quite a few of the compilers did this one by now - particularly for the
trivial things like ieee_is_nan. I agree with Rich Townsend that this
information would be a good thing to collect somewhere.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
Herman D. Knoble
2006-08-28 11:57:24 UTC
Permalink
Richard: Thanks. So far the only compiler claiming the implementation
of these features is the Nag Fortran compiler (and the person claiming
this so far has not reporred the results of my posted little test program.)

The fillowing compilers do NOT (by default) support the module ieee_arithmetic:
Lahey, Salford (Windows), Intel, Pathscale, Absoft, Portland, and G95 (Linux).

Now it could be that the above default compiler libraries do not have thie
module available, but some other compiler library may. So far I cannot
find any documentation for the above compilers that would indicate
availability (support) of the module ieee_arithmetic (via USE in lower
or upper case, and with an underscore (or a dash) in the name.

Skip

On Fri, 25 Aug 2006 11:59:03 -0700, ***@see.signature (Richard Maine) wrote:

-|Herman D. Knoble <***@SPAMpsu.DOT.edu> wrote:
-|
-|> In Fortran 95/2003 Explained, Section 11.93 Elemental functions
-|> indicates a use statement: use ieee-arithmetic
-|...
-|> Question: Does anyone know of a Fortran Compiler which
-|> implements this ieee environment (use and functions)?
-|
-|I don't have a handy list, but it was my unverified impression that
-|quite a few of the compilers did this one by now - particularly for the
-|trivial things like ieee_is_nan. I agree with Rich Townsend that this
-|information would be a good thing to collect somewhere.
Arjen Markus
2006-08-28 14:38:18 UTC
Permalink
Post by Herman D. Knoble
Lahey, Salford (Windows), Intel, Pathscale, Absoft, Portland, and G95 (Linux).
Neither does gfortran (Linux).

Detailed version information:
GNU Fortran 95 (GCC 4.0.2 20051130 (Red Hat 4.0.2-14.EL4))
Copyright (C) 2005 Free Software Foundation, Inc.

Regards,

Arjen
Michael Metcalf
2006-08-28 15:40:11 UTC
Permalink
Post by Arjen Markus
Post by Herman D. Knoble
Lahey, Salford (Windows), Intel, Pathscale, Absoft, Portland, and G95 (Linux).
Neither does gfortran (Linux).
I thought Sun supported this, but don't have their compiler to check.

Regards,

Mike Metcalf
Richard E Maine
2006-08-28 15:02:54 UTC
Permalink
So far the only compiler claiming the implementation of these features
[the IEEE TR] is the Nag Fortran compiler (and the person claiming this so
far has not reporred the results of my posted little test program.)
I was at home (where I don't have a copy of NAG) on Friday. Ran your
test program with NAG 5.0 on PPC Mac today. It compiles, runs, and
prints "X is NOT NaN" as expected.

I guess I haven't been keeping good track. I knew NAG had this a long
time ago (their 5.0 is about 2 years old). I thought several other
vendors had it by now, but I guess not.

I am more certain that several vendors have at least the functionality
of IEEE_IS_NAN, perhaps under a different name, and have had such a
thing for a long time (since f77 days even). That one is pretty trivial
for a vendor to implement, after all. (Note the "for a vendor"; user
implementation in portable Fortran is not so trivial, as discussed here
multiple times).

If I were wanting to use this functionality with a compiler that didn't
yet implement at least this part of the IEEE TR, I'd probably write my
own short compiler-dependent module which wrapped the vendor intrinsic
to look like the IEEE TR one. That would make the rest of my code
standard f95+TR.
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
Ron Shepard
2006-08-28 16:07:10 UTC
Permalink
Post by Richard E Maine
I guess I haven't been keeping good track. I knew NAG had this a long
time ago (their 5.0 is about 2 years old). I thought several other
vendors had it by now, but I guess not.
These are from some Macintosh compilers. I don't know when the IEEE
support was added, but it was probably two or three years ago. In
particular, both compilers support the ieee_is_nan() function.

The following is from the ABSOFT user guide:

Three modules are provided to support floating-point exceptions and
IEEE arithmetic: IEEE_FEATURES, IEEE_ARITHMETIC, and
IEEE_EXCEPTIONS. Use of these modules and the procedures in them
ensure portability of programs exploiting features of IEEE
arithmetic across platforms. The module IEEE_ARITHMETIC contains a
USE statement for IEEE_EXCEPTIONS. Any procedure that uses
IEEE_ARITHMETIC will have access to the public features of
IEEE_EXCEPTIONS.

The following is from the XLF user guide:

XL Fortran provides several ways that allow you to query and control
the floating-point status and control register of the processor
directly. These include:

* fpgets and fpsets subroutines

* Efficient floating-point control and inquiry procedures

* IEEE floating point procedures, as specified in the Fortran 2003
Draft Standard

$.02 -Ron Shepard
Herman D. Knoble
2006-08-28 16:45:21 UTC
Permalink
Ron: Thanks. My previous statement about Absoft not supporting this
was based on Version 8, which I failed to see. What you are saying
is that Version 9 (current version) does support IEEE floating point
modules. That is good news.

Skip


On Mon, 28 Aug 2006 11:07:10 -0500, Ron Shepard <ron-***@NOSPAM.comcast.net> wrote:

-|In article <1hkrshc.1vt3j32sj7e60N%***@see.signature>,
-| ***@see.signature (Richard E Maine) wrote:
-|
-|> I guess I haven't been keeping good track. I knew NAG had this a long
-|> time ago (their 5.0 is about 2 years old). I thought several other
-|> vendors had it by now, but I guess not.
-|
-|These are from some Macintosh compilers. I don't know when the IEEE
-|support was added, but it was probably two or three years ago. In
-|particular, both compilers support the ieee_is_nan() function.
-|
-|The following is from the ABSOFT user guide:
-|
-|Three modules are provided to support floating-point exceptions and
-|IEEE arithmetic: IEEE_FEATURES, IEEE_ARITHMETIC, and
-|IEEE_EXCEPTIONS. Use of these modules and the procedures in them
-|ensure portability of programs exploiting features of IEEE
-|arithmetic across platforms. The module IEEE_ARITHMETIC contains a
-|USE statement for IEEE_EXCEPTIONS. Any procedure that uses
-|IEEE_ARITHMETIC will have access to the public features of
-|IEEE_EXCEPTIONS.
-|
-|The following is from the XLF user guide:
-|
-|XL Fortran provides several ways that allow you to query and control
-|the floating-point status and control register of the processor
-|directly. These include:
-|
-|* fpgets and fpsets subroutines
-|
-|* Efficient floating-point control and inquiry procedures
-|
-|* IEEE floating point procedures, as specified in the Fortran 2003
-|Draft Standard
-|
-|$.02 -Ron Shepard
Joost
2006-08-28 15:03:05 UTC
Permalink
Post by Herman D. Knoble
Richard: Thanks. So far the only compiler claiming the implementation
of these features is the Nag Fortran compiler (and the person claiming
this so far has not reporred the results of my posted little test program.)
the NAG compiler compiles the prgram fine, and yields
Post by Herman D. Knoble
./a.out
X is NOT NaN

Cheers,

Joost
Loading...