public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/53509] New: exp and log function give unexpected results when called with numbers as arguments
@ 2012-05-28 16:54 f.baart at gmail dot com
  2012-05-28 20:09 ` [Bug fortran/53509] " dominiq at lps dot ens.fr
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: f.baart at gmail dot com @ 2012-05-28 16:54 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: f.baart@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


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

* [Bug fortran/53509] exp and log function give unexpected results when called with numbers as arguments
  2012-05-28 16:54 [Bug fortran/53509] New: exp and log function give unexpected results when called with numbers as arguments f.baart at gmail dot com
@ 2012-05-28 20:09 ` dominiq at lps dot ens.fr
  2012-05-28 23:57 ` kargl at gcc dot gnu.org
  2012-06-06 17:56 ` f.baart at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-05-28 20:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53509

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |howarth at bromo dot
                   |                            |med.uc.edu

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-05-28 18:35:15 UTC ---
It works for me on 10.6 (snow leopard). It looks like as a problem with your
GMP/MPFR install. Could you have a look at the GMP bugs to see if there is
nothing related to 10.7 (lion)? CCed Jack Howarth who will know better.


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

* [Bug fortran/53509] exp and log function give unexpected results when called with numbers as arguments
  2012-05-28 16:54 [Bug fortran/53509] New: exp and log function give unexpected results when called with numbers as arguments f.baart at gmail dot com
  2012-05-28 20:09 ` [Bug fortran/53509] " dominiq at lps dot ens.fr
@ 2012-05-28 23:57 ` kargl at gcc dot gnu.org
  2012-06-06 17:56 ` f.baart at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2012-05-28 23:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53509

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |kargl at gcc dot gnu.org
         Resolution|                            |INVALID

--- Comment #2 from kargl at gcc dot gnu.org 2012-05-28 23:45:18 UTC ---
Not a gfortran problem.  Please, test your MPFR/GMP.


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

* [Bug fortran/53509] exp and log function give unexpected results when called with numbers as arguments
  2012-05-28 16:54 [Bug fortran/53509] New: exp and log function give unexpected results when called with numbers as arguments f.baart at gmail dot com
  2012-05-28 20:09 ` [Bug fortran/53509] " dominiq at lps dot ens.fr
  2012-05-28 23:57 ` kargl at gcc dot gnu.org
@ 2012-06-06 17:56 ` f.baart at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: f.baart at gmail dot com @ 2012-06-06 17:56 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53509

--- Comment #3 from Fedor Baart <f.baart at gmail dot com> 2012-06-06 17:55:54 UTC ---
Thanks, I managed to solve this by recompiling gmp using gcc 4.5 instead of
clang, which is the default in macports.


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

end of thread, other threads:[~2012-06-06 17:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-28 16:54 [Bug fortran/53509] New: exp and log function give unexpected results when called with numbers as arguments f.baart at gmail dot com
2012-05-28 20:09 ` [Bug fortran/53509] " dominiq at lps dot ens.fr
2012-05-28 23:57 ` kargl at gcc dot gnu.org
2012-06-06 17:56 ` f.baart at gmail 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).