public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dennis dot wassel at googlemail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/40318] Complex division by zero in gfortran returns wrong results
Date: Mon, 01 Jun 2009 12:15:00 -0000	[thread overview]
Message-ID: <20090601121453.2035.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40318-578@http.gcc.gnu.org/bugzilla/>



------- Comment #6 from dennis dot wassel at googlemail dot com  2009-06-01 12:14 -------
(In reply to comment #3)

> My understanding of infinity in the complex plane is what is called (I
> call?)  "directed inifinity": if abs((a,b)) goes to +Inf and atan2(a,b) has
> a defined value in this limit, then (a,b) goes to infinity in the direction
> given by atan2(a,b).  However (+/-Inf,+/-Inf) defines only four directions
> and is unable to represent general "directed inifinity".  So I think that
> from a "mathematical" point of view the problem is ill-posed,
> (+/-Inf,+/-Inf) is in the same class of "undefined" values as 0/0 or
> Inf/Inf, and should give NaNs.

Then this is the gist of the matter - my FA textbook does not require the
argument to converge, but just the modulus, so our understandings of infinity
differ.
I agree with Dominique in that mathematically (+/-Inf,+/-Inf) is not
well-defined, because the limit of a/b is unknown.

> Now atan2(a,b) is DEFINED such that atan2(+0,+/-0)=+/-0,
> atan2(-0,+/-0)=+/-Pi, atan2(+Inf,+/-Inf)=+/-Pi/4,
> atan2(-Inf,+/-Inf)=+/-3*Pi/4 (it seems that it is even built in the Intel
> hardware).  With this definition of atan2, it is possible to give a
> definition of (+/-Inf,+/-Inf) as the directions of the corners of the
> "infinite square".  I have nothing against this defintion, except it should
> be documented.

The mathematicians among us will writhe in agony, but I think this serves the
purpose best :)

> [...]
> In this case the results at compile and run times should be the
> same ("least surprising approach").

I strongly support that point, because everything else would be a very nasty
gotcha for an average Fortran user like myself.


-- 


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


  parent reply	other threads:[~2009-06-01 12:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01  6:15 [Bug fortran/40318] New: " ghazi at gcc dot gnu dot org
2009-06-01  6:55 ` [Bug fortran/40318] " kargl at gcc dot gnu dot org
2009-06-01  8:35 ` ghazi at gcc dot gnu dot org
2009-06-01 10:19 ` dominiq at lps dot ens dot fr
2009-06-01 11:10 ` burnus at gcc dot gnu dot org
2009-06-01 11:24 ` dominiq at lps dot ens dot fr
2009-06-01 12:15 ` dennis dot wassel at googlemail dot com [this message]
2009-06-01 12:25 ` dominiq at lps dot ens dot fr
2009-06-01 14:21 ` jb at gcc dot gnu dot org
2009-06-01 14:56 ` sgk at troutmask dot apl dot washington dot edu
2009-06-01 18:15 ` ghazi at gcc dot gnu dot org
2009-06-01 19:16 ` sgk at troutmask dot apl dot washington dot edu
2009-06-01 20:34 ` burnus at gcc dot gnu dot org
2009-06-02 15:17 ` ghazi at gcc dot gnu dot org
2009-12-18 14:42 ` pault at gcc dot gnu dot org
2009-12-18 15:52 ` sgk at troutmask dot apl dot washington dot edu
2009-12-18 17:16 ` ghazi at gcc dot gnu dot org
2009-12-19 19:46 ` kargl at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090601121453.2035.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).