This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/29383] New: Fortran 2003/F95[TR15580:1999]: Floating point exception (IEEE) support
- From: "tobias dot burnus at physik dot fu-berlin dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Oct 2006 08:41:38 -0000
- Subject: [Bug fortran/29383] New: Fortran 2003/F95[TR15580:1999]: Floating point exception (IEEE) support
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
See chapter 14 of the Fortran 2003 standard.
Example, cf.
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/642578db8949fd2f
--------------
program ieee
use,intrinsic :: ieee_arithmetic
implicit none
if(.not. IEEE_support_standard(1.0d0) &
.or. .not.IEEE_support_halting(IEEE_INVALID) &
.or. .not.IEEE_support_halting(IEEE_DIVIDE_BY_ZERO)) &
stop 'No IEEE support available!'
call ieee_set_halting_mode([IEEE_INVALID, IEEE_DIVIDE_BY_ZERO],&
.false.)
call printLog(1.0d0)
call printLog(0.0d0)
call printLog(-1.0d0)
call printLog(2.0d0)
contains
subroutine printLog(x)
double precision, intent(in) :: x
double precision :: y
y = log(x)
if(.not. ieee_is_finite(y)) then
write(*,*) 'Ignoring calculation for x = ', x,'; result is: ',y
else
print *, 'Result is: log(',x,') = ',y
end if
end subroutine printLog
end program ieee
--------------
Expected result (NAG f95 gives the following):
Result is: log( 1.0000000000000000 ) = 0.0000000000000000
Ignoring calculation for x = 0.0000000000000000 ; result is:
-Infinity
Ignoring calculation for x = -1.0000000000000000 ; result is: NaN
Result is: log( 2.0000000000000000 ) = 0.6931471805599453
Warning: Floating invalid operand occurred
Warning: Floating divide by zero occurred
--
Summary: Fortran 2003/F95[TR15580:1999]: Floating point exception
(IEEE) support
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tobias dot burnus at physik dot fu-berlin dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29383