This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/29383] New: Fortran 2003/F95[TR15580:1999]: Floating point exception (IEEE) support

See chapter 14 of the Fortran 2003 standard.

Example, cf.
 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],&

  call printLog(1.0d0)
  call printLog(0.0d0)
  call printLog(-1.0d0)
  call printLog(2.0d0)


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
    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:
 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]