X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 	tests=AWL,BAYES_00,J_CHICKENPOX_51,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <f60fe000904011147n7161071ey38a37f4f71499aa@mail.gmail.com>
References: <8704.38224.qm@web25004.mail.ukl.yahoo.com> 	 <20090401173054.GA10205@calimero.vinschen.de> 	 <f60fe000904011147n7161071ey38a37f4f71499aa@mail.gmail.com>
Date: Wed, 1 Apr 2009 14:47:55 -0400
Message-ID: <f60fe000904011147q55181211o6230d1deb626c5c7@mail.gmail.com>
Subject: Fwd: complex number
From: "Mark J. Reed" <markjreed@gmail.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Wed, Apr 1, 2009 at 1:30 PM, Corinna Vinschen wrote:
>
> > > That's the result of the newlib function which is defined
> > > as
> > >
> > > =C2=A0 double
> > > =C2=A0 cabs(z)
> > > =C2=A0 struct complex z;
> > > =C2=A0 {
> > > =C2=A0 =C2=A0 return hypot(z.x, z.y);
> > > =C2=A0 }
> > >

That's from the newlib source code, I assume? While the function
cabs() exists inside newlib, and is declared as an extern in math.h,
it's not documented, nor is there a prototype for it or a declaration
of "struct complex" that I can find anywhere in the installed headers
(just the "complex" typedef in the gcc headers, whose structure
doesn't match the above).=C2=A0 l Yet somehow the compiler is doing some
sort of typechecking anyway and rejecting everything I try to pass as
a parameter, so I can't validate the return value of cabs.

Did you determine that the C++ std::complex::abs() method winds up
calling cabs() eventually, or was that a guess?=C2=A0 It's strange, because
calling hypot(a, b) directly yields the correct result.

--
Mark J. Reed <markjreed@gmail.com>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

