public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/105924] New: false floating point exception when evaluating exponential function @ 2022-06-11 7:20 yelinhui at hotmail dot com 2022-06-11 16:22 ` [Bug fortran/105924] " kargl at gcc dot gnu.org 2022-08-03 8:41 ` yelinhui at hotmail dot com 0 siblings, 2 replies; 3+ messages in thread From: yelinhui at hotmail dot com @ 2022-06-11 7:20 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105924 Bug ID: 105924 Summary: false floating point exception when evaluating exponential function Product: gcc Version: 7.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: yelinhui at hotmail dot com Target Milestone: --- $ gfortran --version GNU Fortran (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 Copyright (C) 2017 Free Software Foundation, Inc. $ cat test.f program test implicit none real*8 :: e e=-4.d2 print *, e, exp(-e*e) end program test $ gfortran -O0 -g -fbacktrace -ffpe-trap=zero,overflow,underflow,invalid,denormal test.f $./a.out Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation. Backtrace for this error: #0 0x1554d03f82ed in ??? #1 0x1554d03f7503 in ??? #2 0x1554cfc8cf0f in ??? #3 0x1554d00c5ea4 in ??? #4 0x1554d004e1fe in ??? #5 0x55b38e68a9d5 in test at /tmp/test.f:7 #6 0x55b38e68aa54 in main at /tmp/test.f:9 Floating point exception (core dumped) ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/105924] false floating point exception when evaluating exponential function 2022-06-11 7:20 [Bug fortran/105924] New: false floating point exception when evaluating exponential function yelinhui at hotmail dot com @ 2022-06-11 16:22 ` kargl at gcc dot gnu.org 2022-08-03 8:41 ` yelinhui at hotmail dot com 1 sibling, 0 replies; 3+ messages in thread From: kargl at gcc dot gnu.org @ 2022-06-11 16:22 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105924 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |kargl at gcc dot gnu.org Resolution|--- |INVALID --- Comment #1 from kargl at gcc dot gnu.org --- Why do you thing that you should not get an exception? e = -400 e*e = 160000 -e*e = -160000 exp(-e*e) = exp(-160000) <-- This is going to underflow to zero. You specifically asked gfortran to signal an exception if underflow occurs with the -ffpe-trap=underflow option. The underflow threshold occurs at x = -745 for exp(x). ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/105924] false floating point exception when evaluating exponential function 2022-06-11 7:20 [Bug fortran/105924] New: false floating point exception when evaluating exponential function yelinhui at hotmail dot com 2022-06-11 16:22 ` [Bug fortran/105924] " kargl at gcc dot gnu.org @ 2022-08-03 8:41 ` yelinhui at hotmail dot com 1 sibling, 0 replies; 3+ messages in thread From: yelinhui at hotmail dot com @ 2022-08-03 8:41 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105924 Lin-Hui Ye <yelinhui at hotmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #2 from Lin-Hui Ye <yelinhui at hotmail dot com> --- Sorry I didn't know this is an underflow. I was expecting exp(-160000) to give a value close to zero. Thanks for the explanation. Linhui (In reply to kargl from comment #1) > Why do you thing that you should not get an exception? > > e = -400 > e*e = 160000 > -e*e = -160000 > exp(-e*e) = exp(-160000) <-- This is going to underflow to zero. > > You specifically asked gfortran to signal an exception if > underflow occurs with the -ffpe-trap=underflow option. The > underflow threshold occurs at x = -745 for exp(x). ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-03 8:41 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-06-11 7:20 [Bug fortran/105924] New: false floating point exception when evaluating exponential function yelinhui at hotmail dot com 2022-06-11 16:22 ` [Bug fortran/105924] " kargl at gcc dot gnu.org 2022-08-03 8:41 ` yelinhui at hotmail dot com
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).