http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53509
Bug #: 53509
Summary: exp and log function give unexpected results when
called with numbers as arguments
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: f.ba...@gmail.com
Created attachment 27513
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27513
test script for testing log and exp function
I noticed that the exp and log function in gfortran 4.7.0 and 4.5.3 on OSX
Lion/macports give unexpected results.
When I call exp(1.0) I get 2.76.. and when I call log(2.71...) I get 1.34...
$ gfortran-mp-4.7 ./test.f90 && ./a.out
2.76998615 1.34896958
I tried debugging the program, when in the debugger calling log(2.71..) results
in the correct value. Another way to get the correct answer is to store the
2.71 in a variable and calling log on that.
I also tried with other real types and they all give different but incorrect
answers.
Please find attached a test program that reproduces the error on OSX Lion.
Cheers,
Fedor
See also:
http://trac.macports.org/ticket/34535
http://stackoverflow.com/questions/10673701/can-i-call-the-fortran-log-function-with-a-number