https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68652
Bug ID: 68652
Summary: gamma function hangs on some arguments, returns NaN on
other ones
Product: gcc
Version: 4.9.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
Assignee: unassigned at gcc dot gnu.org
Reporter: arbautjc at gmail dot com
Target Milestone: ---
This happens with gfortran in MinGW-W64 (precisely
x86_64-4.9.3-release-win32-seh-rt_v4-rev1.7z at
http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.3/threads-win32/seh/).
So it may be a problem with components external to gfortran. The OS is Windows
7 Pro, 64 bits.
Forgive me if it's not the right place to post the bug report.
Anyway, here is what goes wrong:
program bug
implicit none
real(4) :: x, y
do
read *, x
y = gamma(x)
print *, y
end do
end program
With real(4), and an argument that is an integer value (in a real variable, of
course):
x=1 to 35: y has a finite real value, no problem
x=36 to 16777218: y is Infinity, as expected
x=16777219 or above: program hangs.
Notice that 2^24=16777216, by the way.
With real(8)
x=1 to 171: finite real
x=172 to 709: Infinity
x=710 or above: NaN, which is not expected (it should be Infinity).