public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/29383]  New: Fortran 2003/F95[TR15580:1999]: Floating point exception (IEEE) support
@ 2006-10-08  8:41 tobias dot burnus at physik dot fu-berlin dot de
  2006-10-22  7:20 ` [Bug fortran/29383] " fxcoudert at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: tobias dot burnus at physik dot fu-berlin dot de @ 2006-10-08  8:41 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-09-10 13:43 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-29383-4@http.gcc.gnu.org/bugzilla/>
2011-01-24  9:41 ` [Bug fortran/29383] Fortran 2003/F95[TR15580:1999]: Floating point exception (IEEE) support thenlich at users dot sourceforge.net
2011-07-22 17:55 ` longb at cray dot com
2012-10-07  0:09 ` kargl at gcc dot gnu.org
2012-10-09 15:19 ` andy.nelson at lanl dot gov
2012-10-09 17:01 ` kargl at gcc dot gnu.org
2012-12-04 19:28 ` quantheory at gmail dot com
2013-04-14 20:09 ` quantheory at gmail dot com
2014-01-06 11:33 ` janus at gcc dot gnu.org
2014-06-03 18:15 ` w6ws at earthlink dot net
2014-06-07 10:19 ` fxcoudert at gcc dot gnu.org
2014-06-07 10:19 ` fxcoudert at gcc dot gnu.org
2014-06-07 10:23 ` fxcoudert at gcc dot gnu.org
2014-06-07 10:25 ` fxcoudert at gcc dot gnu.org
2014-06-15 16:57 ` fxcoudert at gcc dot gnu.org
2014-06-28 14:18 ` fxcoudert at gcc dot gnu.org
2014-06-28 15:11 ` fxcoudert at gcc dot gnu.org
2022-09-10 13:43 ` vital.had at gmail dot com
2006-10-08  8:41 [Bug fortran/29383] New: " tobias dot burnus at physik dot fu-berlin dot de
2006-10-22  7:20 ` [Bug fortran/29383] " fxcoudert at gcc dot gnu dot org
2009-09-07  8:07 ` burnus at gcc dot gnu dot org
2010-04-14  6:33 ` burnus at gcc dot gnu dot org
2010-06-12 12:15 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).